Commit Graph

428 Commits (3f54c9292fc8ee147d45256e430fbf85fab98128)

Author SHA1 Message Date
Tiago Cunha f62d3d22bb Sync OpenBSD patchset 710:
When the mode-mouse option is on, support dragging to make a selection
in copy mode.

Also support the scroll wheel, although xterm strangely does not ignore
it in application mouse mode, causing redraw artifacts when scrolling up
(other terminals appear to be better behaved).
2010-06-06 00:23:44 +00:00
Nicholas Marriott 510ec3fb9e Fix problems with window sizing seen by Raghavendra D Prabhu when
starting tmux from .xinitrc.

One of the very few things the server relies on the client for now is to
pass through a message on SIGWINCH, but there is a condition where
potentially a SIGWINCH may be lost during the transition from unattached
(main.c) to attached (client.c). So trigger a size change immediately
after the client installs its SIGWINCH handler.

Also, when the terminal is resized, reset the scroll region and cursor
position. Previously, we were clearing our saved idea of these, but in
fact some terminals do not reset them on resize, so this caused problems
during redraw.

While here make a resize to the same size not cause a redraw and rename
the tmux.out output log file to include the tmux PID.
2010-06-05 16:47:11 +00:00
Nicholas Marriott 0440d325d9 Shut up gcc4 warnings. 2010-06-05 16:32:22 +00:00
Nicholas Marriott 43fa9a9ba6 When the mode-mouse option is on, support dragging to make a selection
in copy mode.

Also support the scroll wheel, although xterm strangely does not ignore
it in application mouse mode, causing redraw artifacts when scrolling up
(other terminals appear to be better behaved).
2010-05-31 19:51:29 +00:00
Tiago Cunha a2cd71ff03 Sync OpenBSD patchset 656:
Check for colour and attribute modifications early so the translated
values can be stored in the cached terminal attributes rather than the
requested (untranslated) values. Prevents tmux clearing and setting the
attributes for every character when using aixterm colours.
2010-03-08 14:53:49 +00:00
Nicholas Marriott c7046b9a0c Check for colour and attribute modifications early so the translated
values can be stored in the cached terminal attributes rather than the
requested (untranslated) values. Prevents tmux clearing and setting the
attributes for every character when using aixterm colours.
2010-03-01 22:44:31 +00:00
Tiago Cunha 862b89b78b Sync OpenBSD patchset 654:
Don't set the terminal to nonblocking on detach until we have finished with it
entirely.
2010-02-26 13:34:15 +00:00
Nicholas Marriott f1dd95650b Don't set the terminal to nonblocking on detach until we have finished with it
entirely.
2010-02-24 19:08:39 +00:00
Tiago Cunha ebcc0ebd2d Sync OpenBSD patchset 630:
If redrawing line 0 of the screen onto the tty, there can't be a wrap flag on
the previous line, so move the cursor. Fixes status line redraw issues when
resizing in choose mode and hopefully at other times as well.
2010-02-02 23:56:25 +00:00
Nicholas Marriott 9ffe549ab1 If redrawing line 0 of the screen onto the tty, there can't be a wrap flag on
the previous line, so move the cursor. Fixes status line redraw issues when
resizing in choose mode and hopefully at other times as well.
2010-02-01 23:06:24 +00:00
Tiago Cunha 027f5310b4 Sync OpenBSD patchset 595:
Use tcflush(3) instead of TIOCFLUSH, from Ed Schouten.
2010-01-05 23:49:24 +00:00
Nicholas Marriott 9ee979167a Use tcflush(3) instead of TIOCFLUSH, from Ed Schouten. 2010-01-01 14:29:18 +00:00
Tiago Cunha 71e6b4d617 Sync OpenBSD patchset 594:
Fix the logic so that transition from a 256 colour to default works properly.
2009-12-26 23:50:15 +00:00
Tiago Cunha 51a284e056 Sync OpenBSD patchset 593:
Nuke some stray debugging.
2009-12-26 23:49:27 +00:00
Nicholas Marriott a775107f5f Fix the logic so that transition from a 256 colour to default works properly. 2009-12-26 11:02:32 +00:00
Nicholas Marriott cd9b1b1fd3 Nuke some stray debugging. 2009-12-26 10:39:02 +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 39b1cdbdb9 Sync OpenBSD patchset 583:
vte is buggy and doesn't home the cursor after changing the scroll
region. Several people are hitting this, so add a workaround.
2009-12-04 22:17:26 +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
Tiago Cunha ddb5bb80fa Sync OpenBSD patchset 579:
Reflect the keypad mode of the application so that numlock works.
2009-12-04 22:05:52 +00:00
Nicholas Marriott 796eb522ac vte is buggy and doesn't home the cursor after changing the scroll
region. Several people are hitting this, so add a workaround.
2009-12-04 11:01:29 +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
Nicholas Marriott 6bbc92a6f5 Reflect the keypad mode of the application so that numlock works. 2009-12-02 22:13:15 +00:00
Tiago Cunha b42f231027 Sync OpenBSD patchset 574:
Add a couple of comments.
2009-11-28 14:59:26 +00:00
Tiago Cunha 4c7b3a5906 Sync OpenBSD patchset 571:
Fix type - attributes should be u_char not int.
2009-11-28 14:56:11 +00:00
Tiago Cunha c12e0b0708 Sync OpenBSD patchset 567:
Remove a couple of unused arguments where possible, and add /* ARGSUSED */ to
the rest to reduce lint output.
2009-11-28 14:50:37 +00:00
Tiago Cunha 8ba590b473 Sync OpenBSD patchset 563:
Emulate il1, dl1, ich1 to run (albeit slowly) with vt100 feature set.
2009-11-28 14:42:21 +00:00
Nicholas Marriott 2182e1badc Add a couple of comments. 2009-11-27 09:41:03 +00:00
Nicholas Marriott e7f4319ac6 Fix type - attributes should be u_char not int. 2009-11-26 22:47:14 +00:00
Nicholas Marriott 4ca857e0e9 Remove a couple of unused arguments where possible, and add /* ARGSUSED */ to
the rest to reduce lint output.
2009-11-26 21:37:13 +00:00
Nicholas Marriott d31d4c05cf Emulate il1, dl1, ich1 to run (albeit slowly) with vt100 feature set. 2009-11-26 14:46:08 +00:00
Tiago Cunha a0b2b8e875 Sync OpenBSD patchset 547:
Cleanup by moving various (mostly horrible) little bits handling UTF-8 grid
data into functions in a new file, grid-utf8.c, and use sizeof intead of
UTF8_DATA.

Also nuke trailing whitespace from tmux.1, reminded by jmc.
2009-11-19 22:23:27 +00:00
Nicholas Marriott a78cc98c8b Cleanup by moving various (mostly horrible) little bits handling UTF-8 grid
data into functions in a new file, grid-utf8.c, and use sizeof intead of
UTF8_DATA.

Also nuke trailing whitespace from tmux.1, reminded by jmc.
2009-11-18 17:02:17 +00:00
Tiago Cunha 2bd39071d3 Sync OpenBSD patchset 532:
Emulate the ri (reverse index) capability: this allows tmux to at least start
on Sun consoles (TERM=sun or sun-color), even if there appear to still be
problems on some boxes (my Blade 100 is fine but edd's Blade 1000 shows odd
screen corruption).
2009-11-13 16:57:21 +00:00
Nicholas Marriott 5ae542e7ee Emulate the ri (reverse index) capability: this allows tmux to at least start
on Sun consoles (TERM=sun or sun-color), even if there appear to still be
problems on some boxes (my Blade 100 is fine but edd's Blade 1000 shows odd
screen corruption).
2009-11-12 08:05:23 +00:00
Tiago Cunha c01816c26d Sync OpenBSD patchset 520:
Just ignore tty fd errors rather than dying, stops the server dying if the
session is disconnected abrubtly (eg ssh ~.).
2009-11-10 23:27:57 +00:00
Nicholas Marriott 6609093625 Just ignore tty fd errors rather than dying, stops the server dying if the
session is disconnected abrubtly (eg ssh ~.).
2009-11-09 22:50:29 +00:00
Tiago Cunha dcb85fe4b1 Sync OpenBSD patchset 516:
Clear to the end of the screen from the right starting point when drawing
line-by-line (in panes or if ed not supported). Fixes problem spotted by Frank
Terbeck.
2009-11-08 23:34:47 +00:00
Tiago Cunha 66957412d5 Sync OpenBSD patchset 508:
Switch tty key input over to happen on a read event. This is a bit more
complicated because of escape input, but in that case instead of processing a
key immediately, schedule a timer and reprocess the bufer when it expires.

This currently assumes that keys will be atomic (ie that if eg F1 is pressed
the entire sequence is present in the buffer). This is usually but not always
true, a change in the tree format so it can differentiate potential (partial)
key sequences will happens soon and will allow this to be fixed.
2009-11-08 23:26:56 +00:00
Tiago Cunha 971a7b2fe0 Sync OpenBSD patchset 495:
Switch tty fds over to a bufferevent.
2009-11-08 22:58:38 +00:00
Nicholas Marriott bed8153ba0 Clear to the end of the screen from the right starting point when drawing
line-by-line (in panes or if ed not supported). Fixes problem spotted by Frank
Terbeck.
2009-11-05 22:35:28 +00:00
Nicholas Marriott b58bf49e91 Switch tty key input over to happen on a read event. This is a bit more
complicated because of escape input, but in that case instead of processing a
key immediately, schedule a timer and reprocess the bufer when it expires.

This currently assumes that keys will be atomic (ie that if eg F1 is pressed
the entire sequence is present in the buffer). This is usually but not always
true, a change in the tree format so it can differentiate potential (partial)
key sequences will happens soon and will allow this to be fixed.
2009-11-05 08:45:08 +00:00
Tiago Cunha 27c2b98f5f Sync OpenBSD patchset 489:
Ignore the colour on space, /not/ the attributes.
2009-11-04 23:10:43 +00:00
Tiago Cunha 344a241c28 Sync OpenBSD patchset 488:
Fix the reverse emulation when a terminal doesn't have setab to use the correct
fg/bg (adjusted if spaces) and happen before attribute setting.
2009-11-04 23:09:48 +00:00
Nicholas Marriott 7342615c7d Switch tty fds over to a bufferevent. 2009-11-04 21:47:42 +00:00
Nicholas Marriott 10f58cb1bc Ignore the colour on space, /not/ the attributes. 2009-11-04 15:59:27 +00:00
Nicholas Marriott a94535f318 Fix the reverse emulation when a terminal doesn't have setab to use the correct
fg/bg (adjusted if spaces) and happen before attribute setting.
2009-11-04 13:34:26 +00:00
Tiago Cunha d13d3a9902 Sync OpenBSD patchset 471:
Add a minor optimisatin: if the character being printed is space, don't worry
about setting the background colour or attributes (except reverse).
2009-10-28 23:17:28 +00:00
Tiago Cunha c529c02ac0 Sync OpenBSD patchset 470:
Twaek this slightly to avoid confusing use of flags variable.
2009-10-28 23:16:30 +00:00
Tiago Cunha 745fd16452 Sync OpenBSD patchset 469:
Setting SGR0 when setting the fg and bg has problems if only one of the two is
meant to be default, so rewrite the code to move this outside, move setting
colours before attributes and generally clean up.

Tested by sthen@, fixes problems he was seeing with mutt and should fix some
existing problems with (rarely) lost attributes.
2009-10-28 23:15:32 +00:00
Tiago Cunha a5acabd923 Sync OpenBSD patchset 467:
tabs are better; ok nicm
2009-10-28 23:12:38 +00:00
Tiago Cunha 41863470ba Sync OpenBSD patchset 446:
Remove the -d flag to tmux and just use op/AX to detect default colours.

Irritatingly, although op can be used to tell if a terminal supports default
colours, it can't be used to set them because in some terminfo descriptions it
resets attributes as a side-effect (acts as sgr0) and in others it doesn't, so
it is not possible to determine reliably what the terminal state will be
afterwards. So if AX is missing and op is present, tmux just sends sgr0.

Anyone using -d for a terminal who finds they actually needed it can replace it
using terminal-overrides, but please let me know as it is probably an omission
from terminfo.
2009-10-28 22:48:35 +00:00
Nicholas Marriott 1eaefbf169 Add a minor optimisatin: if the character being printed is space, don't worry
about setting the background colour or attributes (except reverse).
2009-10-28 08:52:36 +00:00
Nicholas Marriott 5730cbf3e3 Twaek this slightly to avoid confusing use of flags variable. 2009-10-28 08:33:20 +00:00
Nicholas Marriott eb5f4460d1 Setting SGR0 when setting the fg and bg has problems if only one of the two is
meant to be default, so rewrite the code to move this outside, move setting
colours before attributes and generally clean up.

Tested by sthen@, fixes problems he was seeing with mutt and should fix some
existing problems with (rarely) lost attributes.
2009-10-28 08:27:33 +00:00
Theo Deraadt ed62d1263c tabs are better; ok nicm 2009-10-26 21:42:04 +00:00
Nicholas Marriott 3a7636ff0f Remove the -d flag to tmux and just use op/AX to detect default colours.
Irritatingly, although op can be used to tell if a terminal supports default
colours, it can't be used to set them because in some terminfo descriptions it
resets attributes as a side-effect (acts as sgr0) and in others it doesn't, so
it is not possible to determine reliably what the terminal state will be
afterwards. So if AX is missing and op is present, tmux just sends sgr0.

Anyone using -d for a terminal who finds they actually needed it can replace it
using terminal-overrides, but please let me know as it is probably an omission
from terminfo.
2009-10-25 21:11:21 +00:00
Tiago Cunha c6828bf32b Sync OpenBSD patchset 432:
Unused variable.
2009-10-23 17:28:29 +00:00
Tiago Cunha dbf2351d3a Sync OpenBSD patchset 429:
Now we are correctly not redrawing the whole pane on linefeed, redo the
last-cursor-position code to move to the right position when panes reach EOL.
2009-10-23 17:25:51 +00:00
Tiago Cunha a572533c89 Sync OpenBSD patchset 427:
Don't redraw the scroll region on linefeed/reverse index unless it is necessary
(the cursor is at the bottom/top). Should fix slow cursor movement when using
vi in a pane spotted by pirofti@.
2009-10-23 17:23:52 +00:00
Tiago Cunha 8ec8d1f32a Sync OpenBSD patchset 426:
Some terminals don't correctly clear their let's-wrap flag after changing the
scroll region (which moves the cursor to 0,0). This means that if the cursor
was at the edge of the screen, any further output after scroll region change
incorrectly causes a line wrap. Add a workaround to move the cursor to position
0 if it is at the screen edge before changing scroll region.
2009-10-23 17:22:39 +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
Tiago Cunha c643ac4827 Sync OpenBSD patchset 420:
UTF-8 combined character fixes.

Thai can have treble combinations (1 x width=1 then 2 x width=0) so bump the
UTF-8 cell data size to 9 and alter the code to allow this.

Also break off the combining code into a separate function, handle any further
combining beyond the buffer size by replacing the character with _s, and when
redrawing the UTF-8 character don't assume the first part has just been
printed, redraw the entire line.
2009-10-23 17:13:10 +00:00
Tiago Cunha 97e02eae7d Sync OpenBSD patchset 419:
Move the check for whether to force a line wrapper lower down into the tty code
where it has access to the tty width, which is what should have been checked.
2009-10-23 17:11:26 +00:00
Tiago Cunha 2f14ef61ff Sync OpenBSD patchset 416:
Always move the cursor position on !xenl terminals, since there is no invisible
last cursor position.

Also nuke an unused variable.
2009-10-23 17:08:30 +00:00
Tiago Cunha ac4e4a2b6c Sync OpenBSD patchset 414:
Instead of having a complicated check to see if the cursor is in the last
position to avoid an explicit wrap, actually move it there.

Some UTF-8 fixes to come.
2009-10-23 17:06:23 +00:00
Tiago Cunha 13d1df659f Sync OpenBSD patchset 413:
When checking whether the region will scroll and the cursor position is thus
unsuitable for using CUD/CUU, check the current cursor position not the target
position.
2009-10-23 17:03:48 +00:00
Nicholas Marriott 59e667906f Unused variable. 2009-10-21 19:27:09 +00:00
Nicholas Marriott dd46f634fe Now we are correctly not redrawing the whole pane on linefeed, redo the
last-cursor-position code to move to the right position when panes reach EOL.
2009-10-21 16:52:30 +00:00
Nicholas Marriott 9b5da97e6f Don't redraw the scroll region on linefeed/reverse index unless it is necessary
(the cursor is at the bottom/top). Should fix slow cursor movement when using
vi in a pane spotted by pirofti@.
2009-10-21 13:42:44 +00:00
Nicholas Marriott 683ddbc466 Some terminals don't correctly clear their let's-wrap flag after changing the
scroll region (which moves the cursor to 0,0). This means that if the cursor
was at the edge of the screen, any further output after scroll region change
incorrectly causes a line wrap. Add a workaround to move the cursor to position
0 if it is at the screen edge before changing scroll region.
2009-10-21 09:36:53 +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
Nicholas Marriott 62f234ce3b UTF-8 combined character fixes.
Thai can have treble combinations (1 x width=1 then 2 x width=0) so bump the
UTF-8 cell data size to 9 and alter the code to allow this.

Also break off the combining code into a separate function, handle any further
combining beyond the buffer size by replacing the character with _s, and when
redrawing the UTF-8 character don't assume the first part has just been
printed, redraw the entire line.
2009-10-20 17:33:33 +00:00
Nicholas Marriott 387f4d42cc Move the check for whether to force a line wrapper lower down into the tty code
where it has access to the tty width, which is what should have been checked.
2009-10-20 16:32:23 +00:00
Nicholas Marriott daa26079ee Always move the cursor position on !xenl terminals, since there is no invisible
last cursor position.

Also nuke an unused variable.
2009-10-17 08:35:38 +00:00
Nicholas Marriott 43d62c1ae3 Instead of having a complicated check to see if the cursor is in the last
position to avoid an explicit wrap, actually move it there.

Some UTF-8 fixes to come.
2009-10-17 08:24:46 +00:00
Nicholas Marriott 70355021d8 When checking whether the region will scroll and the cursor position is thus
unsuitable for using CUD/CUU, check the current cursor position not the target
position.
2009-10-16 19:09:40 +00:00
Tiago Cunha b8e4bd2029 Sync OpenBSD patchset 404:
Don't try to use \n across scroll region when doing \r\n either.
2009-10-15 01:44:15 +00:00
Tiago Cunha fe99f6fa11 Sync OpenBSD patchset 402:
Instead of using something sort of similar for both newline checks, use
something the same. Doesn't fix the bug I'm looking for though :-/.
2009-10-15 01:42:07 +00:00
Tiago Cunha 6103628129 Sync OpenBSD patchset 401:
When drawing lines that have wrapped naturally, don't force a newline but
permit them to wrap naturally again. This allows terminals that use this to
guess where lines start and end for eg mouse selecting (like xterm) to work
correctly.

This was another long-standing issue raised by several people over the last
while.

Thanks to martynas@ for much testing. This was not trivial to get right so
bringing it in for wider testing and adn to fix any further glitches in-tree.
2009-10-15 01:41:14 +00:00
Tiago Cunha 04db3c6211 Sync OpenBSD patchset 399:
Don't run through the column unchanged case if the row was unchanged but there
were no suitable optimisations, instead make it an else to fall through to
absolute addressing.
2009-10-15 01:38:09 +00:00
Tiago Cunha 858b8b190b Sync OpenBSD patchset 398:
If the vertical cursor movement crosses the scroll region, CUU and CUD
shouldn't be used even if VPA isn't present - in that case CUP should be used.
2009-10-15 01:36:53 +00:00
Tiago Cunha 9e4a3d50f0 Sync OpenBSD patchset 396:
Use absolute movement if right at the end of the line as it isn't a reliable
place to move from relatively.
2009-10-15 01:34:28 +00:00
Tiago Cunha 44fd6f4381 Sync OpenBSD patchset 395:
Use relative cursor movement instead of absolute when possible and when
supported by the terminal to reduce the size of the output data (generally
about 10-20%).
2009-10-15 01:33:21 +00:00
Tiago Cunha 8bdcc10c8f Sync OpenBSD patchset 393:
Similarly add a tty_cursor_pane function to tidy up most of the calls.
2009-10-15 01:30:00 +00:00
Tiago Cunha 6369fca253 Sync OpenBSD patchset 392:
_absolute is redundant, just use tty_region.
2009-10-15 01:28:14 +00:00
Tiago Cunha 9b771a96f0 Sync OpenBSD patchset 391:
Cleanup: use two functions for region setting, one for absolute and one inside
pane.
2009-10-15 01:26:50 +00:00
Nicholas Marriott 5d78371628 Don't try to use \n across scroll region when doing \r\n either. 2009-10-13 08:37:15 +00:00
Nicholas Marriott 4dcb5040a0 Instead of using something sort of similar for both newline checks, use
something the same. Doesn't fix the bug I'm looking for though :-/.
2009-10-13 00:44:16 +00:00
Nicholas Marriott d7626cd9d7 When drawing lines that have wrapped naturally, don't force a newline but
permit them to wrap naturally again. This allows terminals that use this to
guess where lines start and end for eg mouse selecting (like xterm) to work
correctly.

This was another long-standing issue raised by several people over the last
while.

Thanks to martynas@ for much testing. This was not trivial to get right so
bringing it in for wider testing and adn to fix any further glitches in-tree.
2009-10-12 17:19:47 +00:00
Nicholas Marriott 693b3d03e6 Don't run through the column unchanged case if the row was unchanged but there
were no suitable optimisations, instead make it an else to fall through to
absolute addressing.
2009-10-12 16:41:02 +00:00
Nicholas Marriott eb9826f65d If the vertical cursor movement crosses the scroll region, CUU and CUD
shouldn't be used even if VPA isn't present - in that case CUP should be used.
2009-10-12 16:37:43 +00:00
Nicholas Marriott 0aab5811ca Use absolute movement if right at the end of the line as it isn't a reliable
place to move from relatively.
2009-10-12 14:54:19 +00:00
Nicholas Marriott 687c4a9fab Use relative cursor movement instead of absolute when possible and when
supported by the terminal to reduce the size of the output data (generally
about 10-20%).
2009-10-12 13:01:18 +00:00
Nicholas Marriott 762459954f Similarly add a tty_cursor_pane function to tidy up most of the calls. 2009-10-12 09:29:58 +00:00
Nicholas Marriott 972a6f5656 _absolute is redundant, just use tty_region. 2009-10-12 09:16:59 +00:00
Nicholas Marriott f05b32f7ad Cleanup: use two functions for region setting, one for absolute and one inside
pane.
2009-10-12 09:09:35 +00:00
Tiago Cunha f92cc84631 Sync OpenBSD patchset 390:
Like linefeed, don't set the scroll region for reverse index unless it will be
needed.

While here, also tidy up a couple of long lines and remove an extraneous blank.
2009-10-12 00:41:00 +00:00
Tiago Cunha 2486a36af3 Sync OpenBSD patchset 372:
There is no point setting the scroll region up for line feeds unless scrolling
is actually going to happen, so don't.
2009-10-11 23:39:37 +00:00
Nicholas Marriott 0a2a354499 Like linefeed, don't set the scroll region for reverse index unless it will be
needed.

While here, also tidy up a couple of long lines and remove an extraneous blank.
2009-10-11 22:35:10 +00:00
Nicholas Marriott 3a20a05a49 There is no point setting the scroll region up for line feeds unless scrolling
is actually going to happen, so don't.
2009-10-10 10:36:46 +00:00
Tiago Cunha cddb781127 Sync OpenBSD patchset 368:
The UTF-8 detection idea doesn't work and I am reasonably happy with the
current methods, so remove the (already #ifdef 0'd) code.
2009-10-09 13:11:42 +00:00
Tiago Cunha 765a38e534 Sync OpenBSD patchset 366:
Be less aggressive about turning the cursor off, only explicitly turn it off
when tmux is redrawing, otherwise leave in the state set by the application.
2009-10-09 13:03:28 +00:00
Nicholas Marriott bf38a311da The UTF-8 detection idea doesn't work and I am reasonably happy with the
current methods, so remove the (already #ifdef 0'd) code.
2009-10-09 07:33:12 +00:00
Nicholas Marriott d528184836 Be less aggressive about turning the cursor off, only explicitly turn it off
when tmux is redrawing, otherwise leave in the state set by the application.
2009-10-09 07:23:28 +00:00
Tiago Cunha 5be3fb86b9 Sync OpenBSD patchset 350:
Support -c like sh(1) to execute a command, useful when tmux is a login
shell. Suggested by halex@.

This includes another protocol version increase (the last for now) so again
restart the tmux server before upgrading.
2009-09-23 15:18:56 +00:00
Tiago Cunha fea7bda58f Sync OpenBSD patchset 348:
Don't die if the client is detaching (the tty has been closed) after waking up
from locking.
2009-09-23 15:08:21 +00:00
Tiago Cunha 1310ea2729 Sync OpenBSD patchset 347:
Remove the internal tmux locking and instead detach each client and run the
command specified by a new option "lock-command" (by default "lock -np") in
each client.

This means each terminal has to be unlocked individually but simplifies the
code and allows the system password to be used to unlock.

Note that the set-password command is gone, so it will need to be removed from
configuration files, and the -U command line flag has been removed.

This is the third protocol version change so again it is best to stop the tmux
server before upgrading.
2009-09-23 15:00:09 +00:00
Tiago Cunha 2acf349d4e Sync OpenBSD patchset 346:
Trim some code by moving the ioctl(TIOCGWINSZ) after SIGWINCH from the client
into the server.

This is another (the second of four) protocol version changes coming this
morning, so again the server should be killed before upgrading.
2009-09-23 14:44:02 +00:00
Tiago Cunha acedc2dcf2 Sync OpenBSD patchset 345:
Don't attempt to open() the tty path, rely on the client sending its stdin fd
with imsg and fatal if it doesn't, then set the FD_CLOEXEC flag in tty_init
instead of tty_open to prevent them leaking into child processes if any are
created between the two calls.

This bumps the protocol version, so the tmux server should be killed before
upgrading.
2009-09-23 14:39:30 +00:00
Tiago Cunha c40d8cbda4 Sync OpenBSD patchset 344:
Be more careful about what flags are cleared when opening the terminal,
otherwise the opened/started flags are cleared and the terminal never released.
2009-09-23 14:33:13 +00:00
Nicholas Marriott 9200a0be7a Support -c like sh(1) to execute a command, useful when tmux is a login
shell. Suggested by halex@.

This includes another protocol version increase (the last for now) so again
restart the tmux server before upgrading.
2009-09-23 12:03:30 +00:00
Nicholas Marriott 631a618238 Don't die if the client is detaching (the tty has been closed) after waking up
from locking.
2009-09-23 07:25:31 +00:00
Nicholas Marriott b01dcd7971 Remove the internal tmux locking and instead detach each client and run the
command specified by a new option "lock-command" (by default "lock -np") in
each client.

This means each terminal has to be unlocked individually but simplifies the
code and allows the system password to be used to unlock.

Note that the set-password command is gone, so it will need to be removed from
configuration files, and the -U command line flag has been removed.

This is the third protocol version change so again it is best to stop the tmux
server before upgrading.
2009-09-23 06:18:47 +00:00
Nicholas Marriott 962fa20b36 Trim some code by moving the ioctl(TIOCGWINSZ) after SIGWINCH from the client
into the server.

This is another (the second of four) protocol version changes coming this
morning, so again the server should be killed before upgrading.
2009-09-23 06:12:58 +00:00
Nicholas Marriott 64caf59e84 Don't attempt to open() the tty path, rely on the client sending its stdin fd
with imsg and fatal if it doesn't, then set the FD_CLOEXEC flag in tty_init
instead of tty_open to prevent them leaking into child processes if any are
created between the two calls.

This bumps the protocol version, so the tmux server should be killed before
upgrading.
2009-09-23 06:05:02 +00:00
Nicholas Marriott 0a9005678d Be more careful about what flags are cleared when opening the terminal,
otherwise the opened/started flags are cleared and the terminal never released.
2009-09-22 19:11:52 +00:00
Tiago Cunha 0ec1ce005c Sync OpenBSD patchset 322:
Permit options such as status-bg to be configured using the entire 256 colour
palette by setting "colour0" to "colour255".
2009-09-11 14:13:52 +00:00
Nicholas Marriott 372a8cb1d9 Permit options such as status-bg to be configured using the entire 256 colour
palette by setting "colour0" to "colour255".
2009-09-10 17:16:24 +00:00
Tiago Cunha ed3535db8a Sync OpenBSD patchset 302:
Add a new display-panes command, with two options (display-panes-colour and
display-panes-time), which displays a visual indication of the number of each
pane.
2009-08-31 22:30:15 +00:00
Nicholas Marriott 04319964b9 Add a new display-panes command, with two options (display-panes-colour and
display-panes-time), which displays a visual indication of the number of each
pane.
2009-08-31 20:46:19 +00:00
Tiago Cunha 633e74ef80 Sync OpenBSD patchset 287:
Emulate dch/dch1 if missing by redrawing the entire line.
2009-08-21 21:15:00 +00:00
Nicholas Marriott 926b52b600 Emulate dch/dch1 if missing by redrawing the entire line. 2009-08-21 12:29:59 +00:00
Nicholas Marriott 620402a833 This is a better fix for OS X stupidity. 2009-08-19 09:00:06 +00:00
Tiago Cunha 7182f6d799 Sync OpenBSD patchset 262:
Send SGR0 when initialising the screen. Fixes problems on terminals with BCE
(like putty) if the background colours is non-default when tmux starts. May
also fix problems when resuming a suspended tmux.
2009-08-16 19:31:37 +00:00
Tiago Cunha 05fe69eb92 Sync OpenBSD patchset 250:
A tty context must not be modified as it may be reused to update multiple
clients, so make it const.

Also fix an actual modification which caused a hang when a session was
connected to multiple terminals at least one of which was missing ich/ich1.
2009-08-14 21:30:24 +00:00
Tiago Cunha 7f77c395e3 Sync OpenBSD patchset 247:
Initialise log_fd to -1, prevents spurious disconnection of the client when it
ends up as fd 0 (likely if the server is started with "tmux start").

Also add some extra debugging messages to server.c.
2009-08-14 21:24:46 +00:00
Tiago Cunha e2a18894b3 Sync OpenBSD patchset 246:
Have the client pass its stdin fd to the server when identifying itself and
have the server use that rather than reopening the tty. If the fd isn't given,
use the old behaviour (so no need for a version change).

This allows tmux to be used as the shell, so also change so that when working
out the command to execute if default-command is empty (the default), tmux will
try not execute itself.
2009-08-14 21:23:20 +00:00
Tiago Cunha 0714e41148 Sync OpenBSD patchset 245:
Add a TTY_OPENED flag and tidy a little.
2009-08-14 21:20:01 +00:00
Tiago Cunha 5cc971facd Sync OpenBSD patchset 244:
Drop the no_stop argument to tty_close and tty_free in favour of a flag in the
tty struct.
2009-08-14 21:17:54 +00:00
Nicholas Marriott 5cf994856f Send SGR0 when initialising the screen. Fixes problems on terminals with BCE
(like putty) if the background colours is non-default when tmux starts. May
also fix problems when resuming a suspended tmux.
2009-08-14 08:53:52 +00:00
Nicholas Marriott bc497dbb92 A tty context must not be modified as it may be reused to update multiple
clients, so make it const.

Also fix an actual modification which caused a hang when a session was
connected to multiple terminals at least one of which was missing ich/ich1.
2009-08-12 09:41:59 +00:00
Nicholas Marriott e0a19abb99 Initialise log_fd to -1, prevents spurious disconnection of the client when it
ends up as fd 0 (likely if the server is started with "tmux start").

Also add some extra debugging messages to server.c.
2009-08-11 22:34:17 +00:00
Nicholas Marriott 4310282a4c Have the client pass its stdin fd to the server when identifying itself and
have the server use that rather than reopening the tty. If the fd isn't given,
use the old behaviour (so no need for a version change).

This allows tmux to be used as the shell, so also change so that when working
out the command to execute if default-command is empty (the default), tmux will
try not execute itself.
2009-08-11 21:28:11 +00:00
Nicholas Marriott 4ec8ade11c Add a TTY_OPENED flag and tidy a little. 2009-08-11 20:29:04 +00:00
Nicholas Marriott ff65e37545 Drop the no_stop argument to tty_close and tty_free in favour of a flag in the
tty struct.
2009-08-11 19:32:25 +00:00
Tiago Cunha 37b0bcd7c1 Sync OpenBSD patchset 226:
Change the way the grid is stored, previously it was:

- a two-dimensional array of cells;
- a two-dimensional array of utf8 data;
- an array of line lengths.

Now it is a single array of a new struct grid_line each of which represents a
line and contains the length and an array of cells and an array of utf8 data.

This will make it easier to add additional per-line members, such as flags.
2009-08-09 17:28:24 +00:00
Tiago Cunha 88b83be07b Sync OpenBSD patchset 220:
If colours are not supported by the terminal, try to emulate a coloured
background by setting or clearing the reverse attribute.

This makes a few applications which don't use the reverse attribute themselves
a little happier, and allows the status, message and mode options to have
default attributes and fg/bg options that work as expected when set as reverse.
2009-08-09 16:50:57 +00:00
Tiago Cunha 15f6a41a75 Sync OpenBSD patchset 211:
Add a terminal-overrides session option allowing individual terminfo(5) entries
to be overridden. The 88col/256col checks are now moved into the default
setting and out of the code.

Also remove a couple of old workarounds for xterm and rxvt which are no longer
necessary (tmux can emulate them if missing).
2009-08-09 15:26:24 +00:00
Nicholas Marriott 5e01b6d663 Change the way the grid is stored, previously it was:
- a two-dimensional array of cells;
- a two-dimensional array of utf8 data;
- an array of line lengths.

Now it is a single array of a new struct grid_line each of which represents a
line and containts the length and an array of cells and an array of utf8 data.

This will make it easier to add additional per-line members, such as flags.
2009-08-08 13:29:27 +00:00
Nicholas Marriott bcddddf98d If colours are not supported by the terminal, try to emulate a coloured
background by setting or clearing the reverse attribute.

This makes a few applications which don't use the reverse attribute themselves
a little happier, and allows the status, message and mode options to have
default attributes and fg/bg options that work as expected when set as reverse.
2009-08-05 16:26:38 +00:00
Nicholas Marriott 1673735f02 Add a terminal-overrides session option allowing individual terminfo(5) entries
to be overridden. The 88col/256col checks are now moved into the default
setting and out of the code.

Also remove a couple of old workarounds for xterm and rxvt which are no longer
necessary (tmux can emulate them if missing).
2009-08-03 14:10:54 +00:00
Tiago Cunha 7562781c9d Sync OpenBSD patchset 186:
Draw UTF-8 characters under the selection correctly.
2009-07-28 22:41:38 +00:00
Nicholas Marriott fc65da1eed Draw UTF-8 characters under the selection correctly. 2009-07-27 11:33:21 +00:00
Tiago Cunha c84145751a Sync OpenBSD patchset 164:
tty_write is relatively short and the only function left in tty-write.c so
move it into tty.c.
2009-07-23 12:57:45 +00:00
Tiago Cunha b72f9bea43 Sync OpenBSD patchset 162:
More tty code tidying: move the saved cursor/region position (from before the
screen was updated) out of struct screen and into struct tty_ctx.
2009-07-23 12:48:18 +00:00
Tiago Cunha 9c6fa90857 Sync OpenBSD patchset 160:
enum tty_cmd is only used as an index into the array of command function
pointers, so remove it and use the function pointers directly to represent
themselves.
2009-07-23 12:38:01 +00:00
Nicholas Marriott dd4a3b24fc tty_write is relatively short and the only function left in tty-write.c so move
it into tty.c.
2009-07-22 20:56:58 +00:00
Nicholas Marriott ddad0be5f7 More tty code tidying: move the saved cursor/region position (from before the
screen was updated) out of struct screen and into struct tty_ctx.
2009-07-22 20:53:38 +00:00
Tiago Cunha b6afa30c39 Sync OpenBSD patchset 159:
There are relatively few arguments to tty_cmd_* functions now, so tidy them up
by using a struct rather than hiding everything with varargs.
2009-07-22 18:08:56 +00:00
Nicholas Marriott 2ec2837daa enum tty_cmd is only used as an index into the array of command function
pointers, so remove it and use the function pointers directly to represent
themselves.
2009-07-22 18:02:23 +00:00
Tiago Cunha 75a44d856e Sync OpenBSD patchset 158:
tty_cmd_raw is only used once, for raw UTF-8 output, so rename it to
tty_cmd_utf8character and eliminate the size argument.
2009-07-22 17:58:42 +00:00
Nicholas Marriott 6a309c53a8 There are relatively few arguments to tty_cmd_* functions now, so tidy them up
by using a struct rather than hiding everything with varargs.
2009-07-22 16:45:31 +00:00
Nicholas Marriott 5bd72ec629 tty_cmd_raw is only used once, for raw UTF-8 output, so rename it to
tty_cmd_utf8character and eliminate the size argument.
2009-07-22 15:55:32 +00:00
Nicholas Marriott fd0971542f Don't send initialisation strings is1/2/3 (barely anything else does) and move
smcup to the first and rmcup to the last sequences output to the terminal. This
allows tmux to use the alternate screen (smcup/rmcup) when available.
2009-07-12 17:08:37 +00:00
Nicholas Marriott 4a6d62e401 Don't send initialisation strings is1/2/3 (barely anything else does) and move
smcup to the first and rmcup to the last sequences output to the terminal. This
allows tmux to use the alternate screen (smcup/rmcup) when available.
2009-07-10 07:11:59 +00:00
Nicholas Marriott 2ddcb51df3 Fix $Id$. 2009-07-08 18:03:03 +00:00
Nicholas Marriott 1825609d8d Handle empty or unset TERM correctly; also fix a fatal() message while here. 2009-07-08 17:58:32 +00:00
Nicholas Marriott 474fdebb7a Handle empty or unset TERM correctly; also fix a fatal() message while here. 2009-07-07 17:24:32 +00:00
Nicholas Marriott 9f0653386b $Id$. 2009-07-01 23:06:32 +00:00
Nicholas Marriott eed4f7600d Fix $Id$. 2009-06-29 22:04:51 +00:00
Nicholas Marriott edc2e7da98 Copy the 256-colour flag into the tty saved cell as well as the actual colour,
otherwise colour 8 isn't reset.
2009-06-29 22:03:09 +00:00
Nicholas Marriott 2660692fb1 Copy the 256-colour flag into the tty saved cell as well as the actual colour,
otherwise colour 8 isn't reset properly.
2009-06-27 12:57:14 +00:00
Nicholas Marriott bb459beb03 Whitespace and more syncing. 2009-06-25 16:34:50 +00:00
Nicholas Marriott a5830b9603 Restore $Id$ and add script to do so. 2009-06-25 16:21:32 +00:00
Nicholas Marriott 582660bdf3 Miscellaneous unused functions, including one which was basically a
duplicate. Found by lint.
2009-06-25 16:09:11 +00:00
Nicholas Marriott 947fabc751 Unused variables. Found by lint, no binary change. 2009-06-25 16:05:39 +00:00
Nicholas Marriott 942ea4267d Trying to predict the cursor position for UTF-8 output in the same way as for
normal eight-bit output is wrong, separate it into a different function. Fixes
spacing when mixing UTF-8 with some escape sequences, notably the way w3m does
it.
2009-06-25 16:01:26 +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 49477de55c Fix some miscalculations when clearing to start of screen: the number of lines
to the cursor is cy not cy - 1, and the current cursor cell should be included.
2009-06-25 15:50:48 +00:00
Nicholas Marriott 1675ddb4d1 Miscellaneous unused functions, including one which was basically a
duplicate. Found by lint.
2009-06-25 06:15:04 +00:00
Nicholas Marriott 83078bdcbc Unused variables. Found by lint, no binary change. 2009-06-25 05:56:44 +00:00
Nicholas Marriott 0fdd47660a UTF-8 detection is broken on sparc64; disable until I get time to test it further. 2009-06-24 17:31:03 +00:00
Nicholas Marriott 2de599ac0e Trying to predict the cursor position for UTF-8 output in the same way as for
normal eight-bit output is wrong, separate it into a different function. Fixes
spacing when mixing UTF-8 with some escape sequences, notably the way w3m does
it.
2009-06-24 16:01:02 +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 ebe07c2726 Fix some miscalculations when clearing to start of screen: the number of lines
to the cursor is cy not cy - 1, and the current cursor cell should be included.
2009-06-03 23:26:56 +00:00
Nicholas Marriott 3f76a973ee Recent code to try and detect if a terminal supports UTF-8 by printing to it
fails spectacularly on (at least) sparc64, so disable it for now. Thanks to
naddy and Josh Elsasser for help and testing.
2009-06-02 23:39:32 +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 6db7bd6791 Try to guess if the window is UTF-8 by outputting a three-byte UTF-8 wide character and seeing how much the cursor moves. Currently tries to figure out if this works by some stupid checks on the terminal, these need to be rethought. Also might be better using a width 1 character rather than width 2. 2009-05-19 16:08:35 +00:00
Nicholas Marriott dd2f8d7d74 Don't force wrapping with \n when asked, let the cursor code figure it out. Should fix terminals which use this to detect line breaks. 2009-05-14 16:21:55 +00:00
Nicholas Marriott 143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott 54a5f82588 Region can reset cursor to 0,0 - bad if there is an offset. So sort out region before cursor. 2009-05-04 17:52:14 +00:00
Nicholas Marriott fb543c7707 Use ACS for line drawing characters. 2009-05-04 13:20:02 +00:00
Nicholas Marriott f0a716f484 Use a u_char so top-bit-set update the cursor as well. 2009-04-29 17:50:52 +00:00
Nicholas Marriott 7c5f1af26f Ignore del too. 2009-04-29 17:06:45 +00:00
Nicholas Marriott dbf52facd2 Change scroll/pane redraws to only redraw the single pane affected rather than
the entire window.
2009-04-02 21:08:15 +00:00
Nicholas Marriott 84cde92c8f If redrawing the region would mean redrawing > half the pane, just schedule to
redraw the entire window. Also add a flag to skip updating the window any
further if it is scheduled to be redrawn. This has the effect of batching
multiple redraws together.
2009-04-02 20:30:23 +00:00
Nicholas Marriott b6450b167b Basic horizontal splitting and layout management. Still some redraw and other
issues - particularly, don't mix with manual pane resizing and be careful when
viewing from multiple clients; generally cycling the layout a few times will
fix most problems. Getting this in for testing while I think about how to deal
with manual mode.

Split window as normal and cycle the layouts with C-b space. Some of the
layouts will work better when swap-pane comes along.
2009-04-01 18:21:42 +00:00
Nicholas Marriott 907bec675a FD_CLOEXEC more fds. Still one I can't find... 2009-03-31 22:20:42 +00:00
Nicholas Marriott 6c27f1c335 Draw vertical line on the right when window size is limited. 2009-03-31 18:39:45 +00:00
Nicholas Marriott 8a160f2d58 - Unbreak selection colouring.
- Get UTF-8 check the right way round...
2009-03-30 20:14:50 +00:00
Nicholas Marriott 23fef99009 8 -> UTF8_SIZE. 2009-03-29 11:18:28 +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 587badecdb Clear using ED when redrawing the screen. I foolishly assumed using spaces
would be equivalent and terminals would pick up on this, but apparently
not. This fixes copy and paste in xterm/rxvt.
2009-03-28 10:15:01 +00:00
Nicholas Marriott f6001f9ffc Whoops. Didn't mean to commit this yet. 2009-03-27 16:44:51 +00:00
Nicholas Marriott b97264bb70 Update TODO. 2009-03-27 16:44:00 +00:00
Nicholas Marriott e6d35b6aa4 Support for 88 colour terminals. 2009-03-07 10:29:06 +00:00
Nicholas Marriott 546a9d5257 Don't die on any error from fd. 2009-02-17 18:53:10 +00:00