Commit Graph

208 Commits

Author SHA1 Message Date
Tiago Cunha
b2f301f4e2 Sync OpenBSD patchset 916:
Support DECSCUSR sequence to set the cursor style with two new
terminfo(5) extensions, Cs and Csr. Written by Ailin Nemui.
2011-05-22 16:26:09 +00:00
Tiago Cunha
719755574d Sync OpenBSD patchset 915:
Support xterm(1) cursor colour change sequences through terminfo(5) Cc
(set) and Cr (reset) extensions. Originally by Sean Estabrooks, tweaked
by me and Ailin Nemui.
2011-05-22 16:25:02 +00:00
Nicholas Marriott
3ea5e06bfb Support DECSCUSR sequence to set the cursor style with two new
terminfo(5) extensions, Cs and Csr. Written by Ailin Nemui.
2011-05-20 19:17:39 +00:00
Nicholas Marriott
944b5e6fa0 Support xterm(1) cursor colour change sequences through terminfo(5) Cc
(set) and Cr (reset) extensions. Originally by Sean Estabrooks, tweaked
by me and Ailin Nemui.
2011-05-20 19:03:58 +00:00
Tiago Cunha
a0295b4c2f Sync OpenBSD patchset 866:
Support passing through escape sequences to the underlying terminal by
using DCS with a "tmux;" prefix. Escape characters in the sequences must
be doubled. For example:

$ printf '\033Ptmux;\033\033]12;red\007\033\\'

Will pass \033]12;red\007 to the terminal (and change the cursor colour
in xterm). From Kevin Goodsell.
2011-03-19 23:30:37 +00:00
Tiago Cunha
9bc44043a4 Sync OpenBSD patchset 864:
Fix a typo that meant we did not reset the background colour when it was
omitted in a 256-colour SGR ([48;5m). From Yusuke ENDOH.
2011-03-19 23:28:30 +00:00
Nicholas Marriott
79e30daeae Support passing through escape sequences to the underlying terminal by
using DCS with a "tmux;" prefix. Escape characters in the sequences must
be doubled. For example:

$ printf '\033Ptmux;\033\033]12;red\007\033\\'

Will pass \033]12;red\007 to the terminal (and change the cursor colour
in xterm). From Kevin Goodsell.
2011-03-07 23:46:27 +00:00
Nicholas Marriott
c36f67a288 Fix a typo that meant we did not reset the background colour when it was
omitted in a 256-colour SGR ([48;5m). From Yusuke ENDOH.
2011-03-03 08:53:14 +00:00
Tiago Cunha
04ce5cc2d1 Sync OpenBSD patchset 857:
Use input_clear to reset the APC, DCS, OSC state or it could be reused
improperly by a later state. From Kevin Goodsell.
2011-02-15 15:21:14 +00:00
Nicholas Marriott
b6bb350289 Use input_clear to reset the APC, DCS, OSC state or it could be reused
improperly by a later state. From Kevin Goodsell.
2011-01-28 20:39:22 +00:00
Tiago Cunha
332bfbf273 Sync OpenBSD patchset 845:
Mouse highlight mode (1001) requires a program to cooperate so
supporting it through tmux is not as easy as this, remove it for now.
2011-01-21 23:56:11 +00:00
Nicholas Marriott
8f8e81c0c9 Mouse highlight mode (1001) requires a program to cooperate so
supporting it through tmux is not as easy as this, remove it for now.
2011-01-15 00:16:00 +00:00
Tiago Cunha
219442cff7 Sync OpenBSD patchset 828:
Support for UTF-8 mouse input (\033[1005h). This was added in xterm 262
and supports larger terminals than the older way.

If the new mouse-utf8 option is on, UTF-8 mouse input is enabled for all
UTF-8 terminals. The option defaults to on if LANG etc are set in the
same manner as the utf8 option.

With help and based on code from hsim at gmx.li.
2011-01-07 14:34:45 +00:00
Nicholas Marriott
ac3b78a841 Support for UTF-8 mouse input (\033[1005h). This was added in xterm 262
and supports larger terminals than the older way.

If the new mouse-utf8 option is on, UTF-8 mouse input is enabled for all
UTF-8 terminals. The option defaults to on if LANG etc are set in the
same manner as the utf8 option.

With help and based on code from hsim at gmx.li.
2011-01-03 23:35:21 +00:00
Tiago Cunha
095e1b410a Sync OpenBSD patchset 812:
Support all four of the xterm mouse modes. Based on a diff from hsim at
gmx.li.
2010-12-30 22:27:38 +00:00
Nicholas Marriott
f7c42c21ba Support all four of the xterm mouse modes. Based on a diff from hsim at
gmx.li.
2010-12-29 21:49:06 +00:00
Tiago Cunha
3585feca54 Sync OpenBSD patchset 807:
Style tweaks.
2010-12-25 23:43:53 +00:00
Nicholas Marriott
6fd2b5b87f Style tweaks. 2010-12-23 20:18:39 +00:00
Nicholas Marriott
3a4f765a51 Add an option to alert (monitor) for silence (lack of activity) in a
window. From Thomas Adam.
2010-12-06 22:52:21 +00:00
Nicholas Marriott
e26a351865 Add an option to alert (monitor) for silence (lack of activity) in a
window. From Thomas Adam.
2010-12-06 22:51:02 +00:00
Tiago Cunha
0ed80637e7 Sync OpenBSD patchset 683:
Fix typo in escape state table leading to fatal() when \033} or \033~
was entered, from Chris Johnsen.
2010-04-18 15:11:47 +00:00
Nicholas Marriott
622593a77f Fix typo in escape state table leading to fatal() when \033} or \033~
was entered, from Chris Johnsen.
2010-04-17 23:31:09 +00:00
Nicholas Marriott
4baafd8126 New input parser based on http://vt100.net/emu/dec_ansi_parser. 2010-03-22 19:02:54 +00:00
Nicholas Marriott
9f5b9ba0d6 New input parser based on http://vt100.net/emu/dec_ansi_parser. 2010-03-15 12:51:23 +00:00
Tiago Cunha
10abdd97cf Sync OpenBSD patchset 642:
Add an option to disable the smcup/rmcup alternate screen behaviour inside
tmux. From clemens fischer.
2010-02-08 18:32:34 +00:00
Nicholas Marriott
11dedde511 Add an option to disable the smcup/rmcup alternate screen behaviour inside
tmux. From clemens fischer.
2010-02-08 00:14:38 +00:00
Tiago Cunha
7c3d4e35d7 Sync OpenBSD patchset 599:
Correctly clear 256-colour flag for aixterm colours.
2010-01-08 16:22:02 +00:00
Nicholas Marriott
ad8509f361 Correctly clear 256-colour flag for aixterm colours. 2010-01-06 23:13:52 +00:00
Tiago Cunha
99075aaa72 Sync OpenBSD patchset 589:
Pass through the aixterm bright colours if the terminal supports them (>= 16
colours).
2009-12-16 01:13:09 +00:00
Nicholas Marriott
0dda866679 Pass through the aixterm bright colours if the terminal supports them (>= 16
colours).
2009-12-14 21:33:38 +00:00
Tiago Cunha
cc094fdfe6 Sync OpenBSD patchset 581:
Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...
2009-12-04 22:14:47 +00:00
Nicholas Marriott
15a64b805e Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...
2009-12-03 22:50:09 +00:00
Tiago Cunha
b42f231027 Sync OpenBSD patchset 574:
Add a couple of comments.
2009-11-28 14:59:26 +00:00
Nicholas Marriott
2182e1badc Add a couple of comments. 2009-11-27 09:41:03 +00:00
Tiago Cunha
2df0882722 Sync OpenBSD patchset 498:
Convert the window pane (pty master side) fd over to use a bufferevent.

The evbuffer API is very similar to the existing tmux buffer API so this was
remarkably painless. Not many possible ways to do it, I suppose.
2009-11-08 23:02:56 +00:00
Nicholas Marriott
a02c7e804c Convert the window pane (pty master side) fd over to use a bufferevent.
The evbuffer API is very similar to the existing tmux buffer API so this was
remarkably painless. Not many possible ways to do it, I suppose.
2009-11-04 22:43:11 +00:00
Tiago Cunha
a5acabd923 Sync OpenBSD patchset 467:
tabs are better; ok nicm
2009-10-28 23:12:38 +00:00
Theo Deraadt
ed62d1263c tabs are better; ok nicm 2009-10-26 21:42:04 +00:00
Tiago Cunha
4a87cef46f Sync OpenBSD patchset 441:
Support the bright fg/bg colour SGR 90-97 and 100-107.

Reported by Tim Allen.
2009-10-25 10:39:48 +00:00
Tiago Cunha
21b23f8e54 Sync OpenBSD patchset 424:
%zu not %u, doh.
2009-10-23 17:21:34 +00:00
Tiago Cunha
f41a3914a5 Sync OpenBSD patchset 421:
Try to reduce the UTF-8 mess.

Get rid of passing around u_char[4]s and define a struct utf8_data which has
character data, size (sequence length) and width. Move UTF-8 character
collection into two functions utf8_open/utf8_append in utf8.c which fill in
this struct and use these functions from input.c and the various functions in
screen-write.c.

Space for rather more data than is necessary for one UTF-8 sequence is in the
utf8_data struct because screen_write_copy is still nasty and needs to reinject
the character (after combining) into screen_write_cell.
2009-10-23 17:16:25 +00:00
Nicholas Marriott
c2b8f3b55a Support the bright fg/bg colour SGR 90-97 and 100-107.
Reported by Tim Allen.
2009-10-23 15:48:39 +00:00
Nicholas Marriott
9afb0d739e %zu not %u, doh. 2009-10-20 22:17:33 +00:00
Nicholas Marriott
1af09d6330 Try to reduce the UTF-8 mess.
Get rid of passing around u_char[4]s and define a struct utf8_data which has
character data, size (sequence length) and width. Move UTF-8 character
collection into two functions utf8_open/utf8_append in utf8.c which fill in
this struct and use these functions from input.c and the various functions in
screen-write.c.

Space for rather more data than is necessary for one UTF-8 sequence is in the
utf8_data struct because screen_write_copy is still nasty and needs to reinject
the character (after combining) into screen_write_cell.
2009-10-20 19:18:28 +00:00
Tiago Cunha
ee46dba585 Sync OpenBSD patchset 408:
Handle DECCOLM by just emulating its side-effect of clearing the screen.
2009-10-15 01:53:48 +00:00
Tiago Cunha
cbd3b1bc9b Sync OpenBSD patchset 400:
When backspace is received at the beginning of a line and the previous line was
wrapped, move the cursor back up to the end of the previous line.

Another one of the forgotten persons requested this quite a while ago (I need
to start noting names on todo items...) when it was quite hard to
implement. Now it is easy and I don't see it can do any harm, so hey presto...
2009-10-15 01:39:30 +00:00
Nicholas Marriott
71dc6e04e8 Handle DECCOLM by just emulating its side-effect of clearing the screen. 2009-10-13 15:23:13 +00:00
Nicholas Marriott
8608c6970d When backspace is received at the beginning of a line and the previous line was
wrapped, move the cursor back up to the end of the previous line.

Another one of the forgotten persons requested this quite a while ago (I need
to start noting names on todo items...) when it was quite hard to
implement. Now it is easy and I don't see it can do any harm, so hey presto...
2009-10-12 16:59:55 +00:00
Tiago Cunha
15556ad0d6 Sync OpenBSD patchset 281:
Nuke unused variable.
2009-08-21 21:07:20 +00:00
Tiago Cunha
cc2c061289 Sync OpenBSD patchset 280:
Handle the device attributes (DA) escape sequence.
2009-08-20 11:54:58 +00:00
Tiago Cunha
4631c07483 Sync OpenBSD patchset 275:
Instead of just checking for an empty buffer, which may not be the case if
there is unconsumed data, save the previous size and use it instead. This means
that activity monitoring should work in this (unlikely) event.

Also remove a debugging statement that no longer seems necessary.
2009-08-20 11:48:01 +00:00
Nicholas Marriott
234ad54b2c Nuke unused variable. 2009-08-20 10:48:25 +00:00
Nicholas Marriott
bf121f7c60 Handle the device attributes (DA) escape sequence. 2009-08-19 17:00:31 +00:00
Nicholas Marriott
11f0f812c5 Didn't mean to commit this stuff. 2009-08-19 09:04:48 +00:00
Nicholas Marriott
620402a833 This is a better fix for OS X stupidity. 2009-08-19 09:00:06 +00:00
Nicholas Marriott
036de0c5e4 Instead of just checking for an empty buffer, which may not be the case if
there is unconsumed data, save the previous size and use it instead. This means
that activity monitoring should work in this (unlikely) event.

Also remove a debugging statement that no longer seems necessary.
2009-08-18 21:41:13 +00:00
Tiago Cunha
97eb537f38 Sync OpenBSD patchset 227:
Add a flags member to the grid_line struct and use it to differentiate lines
wrapped at the screen edge from those terminated by a newline. Then use this
when copying to combine wrapped lines together into one.
2009-08-09 17:32:06 +00:00
Tiago Cunha
05eb4ece44 Sync OpenBSD patchset 223:
Using the alternative screen (smcup/rmcup) should also preserve the current
colours and attributes. Found thanks to a report from Taylor Venable.

While here also nuke a couple of extra blank lines.
2009-08-09 16:57:49 +00:00
Nicholas Marriott
06ddd3dcf8 Add a flags member to the grid_line struct and use it to differentiate lines
wrapped at the screen edge from those terminated by a newline. Then use this
when copying to combine wrapped lines together into one.
2009-08-08 15:57:49 +00:00
Nicholas Marriott
04e97e8aef Using the alternative screen (smcup/rmcup) should also preserve the current
colours and attributes. Found thanks to a report from Taylor Venable.

While here also nuke a couple of extra blank lines.
2009-08-07 00:12:13 +00:00
Tiago Cunha
d29b57f597 Sync OpenBSD patchset 155:
Make some functions which return unused values void (mostly found by lint) and
tweak a redundant expression in window_pane_set_mode.
2009-07-22 17:46:53 +00:00
Nicholas Marriott
76a9d98562 Make some functions which return unused values void (mostly found by lint) and
tweak a redundant expression in window_pane_set_mode.
2009-07-21 19:54:22 +00:00
Nicholas Marriott
e63567d51c Support "alternate screen" mode (terminfo smcup/rmcup) typically used by full
screen interactive programs to preserve the screen contents. When activated, it
saves a copy of the visible grid and disables scrolling into and resizing out
of the history; when deactivated the visible data is restored and the history
reenabled.
2009-07-14 06:40:33 +00:00
Nicholas Marriott
359285928b Support "alternate screen" mode (terminfo smcup/rmcup) typically used by full
screen interactive programs to preserve the screen contents. When activated, it
saves a copy of the visible grid and disables scrolling into and resizing out
of the history; when deactivated the visible data is restored and the history
reenabled.
2009-07-13 10:43:52 +00:00
Nicholas Marriott
a5830b9603 Restore $Id$ and add script to do so. 2009-06-25 16:21:32 +00:00
Nicholas Marriott
63b38ef628 Implement the CBT (backward tab) sequence (\033[Z). 2009-06-25 15:54:57 +00:00
Nicholas Marriott
1b245388b5 Proper support for tab stops (\033H etc), using a bitstring(3). Makes another
vttest test happy.
2009-06-25 15:54:38 +00:00
Nicholas Marriott
cd71a13a14 Okay, so I screwed up when testing this, doh. Unbreak so that CAN/SUB actually
do cancel the sequence, and tweak to make the code more clear.
2009-06-25 15:54:03 +00:00
Nicholas Marriott
4eed190649 Oops, CAN and SUB should abort the sequence (return to first state), not remain
in the same state.
2009-06-25 15:53:44 +00:00
Nicholas Marriott
c3c14817c9 More input compatibility love. Support C0 within escape sequences, and the C0
control character VT (vertical tab, \013), which is treated as LF like
VT102. Makes another vttest happy.
2009-06-25 15:52:59 +00:00
Nicholas Marriott
93631b3ca7 Implement the DEC alignment test. With the last change this is enough for the
first cursor test in vttest (in ports) to pass; it still shops a few more
problems though.
2009-06-25 15:51:54 +00:00
Nicholas Marriott
7597cb6834 Pass window titles through vis(1). <0x20 is dropped anyway by the input state
machine but top-bit-set nonprintables could cause trouble, and they are neater
like this anyway.
2009-06-25 15:49:27 +00:00
Nicholas Marriott
f031975dc0 Implement the CBT (backward tab) sequence (\033[Z). 2009-06-04 21:02:21 +00:00
Nicholas Marriott
d42fb43f4f Proper support for tab stops (\033H etc), using a bitstring(3). Makes another
vttest test happy.
2009-06-04 18:48:24 +00:00
Nicholas Marriott
d6015824dd Okay, so I screwed up when testing this, doh. Unbreak so that CAN/SUB actually
do cancel the sequence, and tweak to make the code more clear.
2009-06-04 14:42:14 +00:00
Nicholas Marriott
6c1f03578d Oops, CAN and SUB should abort the sequence (return to first state), not remain
in the same state.
2009-06-04 14:24:49 +00:00
Nicholas Marriott
8dd2f0da3f More input compatibility love. Support C0 within escape sequences, and the C0
control character VT (vertical tab, \013), which is treated as LF like
VT102. Makes another vttest happy.
2009-06-04 14:15:50 +00:00
Nicholas Marriott
52ec9b9ec4 Implement the DEC alignment test. With the last change this is enough for the
first cursor test in vttest (in ports) to pass; it still shops a few more
problems though.
2009-06-03 23:30:40 +00:00
Nicholas Marriott
2faec76afa Pass window titles through vis(1). <0x20 is dropped anyway by the input state
machine but top-bit-set nonprintables could cause trouble, and they are neater
like this anyway.

Suggested by deraadt a few days ago.
2009-06-03 19:33:04 +00:00
Nicholas Marriott
35876eaab9 Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti
2009-06-01 22:58:49 +00:00
Nicholas Marriott
143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott
7d6896ae79 Support NEL. 2009-04-23 21:28:45 +00:00
Nicholas Marriott
cf7b384c43 Better UTF-8 support, including combined characters. Unicode data is now stored
as UTF-8 in a separate array, the code does a lookup into this every time it
gets to a UTF-8 cell. Zero width characters are just appended onto the UTF-8
data for the previous cell. This also means that almost no bytes extra are
wasted non-Unicode data (yay).

Still some oddities, such as copy mode skips over wide characters in a strange
way, and the code could do with some tidying.
2009-03-28 20:17:29 +00:00
Nicholas Marriott
6c0728fe07 Step 2 of the Grand Plan To Make UTF-8 Better.
Split grid into two arrays, one containing grid attributes/flags/colours (keeps
the name grid_cell for now) and a separate with the character data (called
text). The text is stored as a u_short but is treated as a uint64_t elsewhere;
eventually the grid will have two arrays.

I'm not happy with the naming so that might change.

Still need to decide where to go from here. I'm not sure whether to combine
the peek/set functions together, and also whether to continue to treat the
text as a uint64_t (and convert to/from Unicode) or make it a char array
(of size one when UTF-8 disabled, eight when enabled) and keep everything
as UTF-8.

Also since UTF-8 will eventually become an attribute of the grid itself it
might be nice to move all the padding crap into grid.c.
2009-03-28 16:30:05 +00:00
Nicholas Marriott
4cdc228353 Unbreak UTF-8. 2009-01-18 21:46:30 +00:00
Nicholas Marriott
162bacdcd9 Window splitting. Two vertical panes fixed 50% each. This is a huge diff, still a couple of bugs (notably heap corruption somewhere causing segfault on exit). 2009-01-11 23:31:46 +00:00
Nicholas Marriott
a1b43faa43 Trim spaces. 2009-01-10 01:51:22 +00:00
Nicholas Marriott
4ebb85aae8 Don't return NULL when retrieving a string that is too long. 2009-01-08 21:22:01 +00:00
Nicholas Marriott
4846ad1657 Introduce nitems() and use it; use bsearch. 2009-01-07 22:52:33 +00:00
Nicholas Marriott
7a82e86827 Make window options work the same was as session options, add mode-fg/mode-bg options, force -g for global on set/show/setw/showw/ 2008-12-08 16:19:51 +00:00
Nicholas Marriott
d0342f4a04 Ability to show window title on status line. 2008-12-05 20:04:06 +00:00
Nicholas Marriott
5ca710d9e3 Disable UTF-8 by default and add options to enable it. 2008-11-16 13:28:59 +00:00
Nicholas Marriott
6304e23984 Record intermediate for p2/s2 and fake up charset redefinition (some programs use it to switch character set). 2008-11-04 20:41:10 +00:00
Nicholas Marriott
cf092dc27f This breaks mutt. 2008-11-04 20:06:48 +00:00
Nicholas Marriott
25975cf5ae Alternative charset commands. 2008-11-04 19:28:58 +00:00
Nicholas Marriott
185f7297e8 Better OSC support for title setting, and support APC as well. 2008-10-09 21:22:16 +00:00
Nicholas Marriott
22ef1a1379 SGR should not reset charset... don't know how this worked before... 2008-09-26 07:41:01 +00:00
Nicholas Marriott
93aa3f3c21 Make RIS also reset scroll region. 2008-09-26 07:34:12 +00:00
Nicholas Marriott
62457bce0b Trim. 2008-09-26 06:45:28 +00:00
Nicholas Marriott
efe557313a Internal screen data rewrite for better 256 colour/UTF-8 support. 2008-09-25 20:08:57 +00:00