Commit Graph

1102 Commits

Author SHA1 Message Date
Nicholas Marriott 8738141913 When mode-mouse is on (it is off by default), automatically enter copy
mode when the mouse is dragged or the mouse wheel is used. Also exit
copy mode when the mouse wheel is scrolled off the bottom. Discussed
with and written by hsim at gmx dot li.
2011-04-19 21:31:33 +00:00
Nicholas Marriott dc6bd98425 |PatchSet 893
|Date: 2011/04/18 20:49:05
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|Add an option (mouse-select-window) which allows the mouse to be used by
|clicking on the status line, written by hsim at gmx dot li.
2011-04-18 21:07:58 +00:00
Nicholas Marriott 0bb2119781 Add an option (mouse-select-window) which allows the mouse to be used by
clicking on the status line, written by hsim at gmx dot li.
2011-04-18 19:49:05 +00:00
Nicholas Marriott 75f218dc73 If the terminal supports sitm for italics, use it instead of standout
(smso). From Tiago Resende.
2011-04-09 07:48:58 +00:00
Nicholas Marriott 0a09d04e1b If the terminal supports sitm for italics, use it instead of standout
(smso). From Tiago Resende.
2011-04-09 07:48:08 +00:00
Nicholas Marriott e5f4bf3f3e |PatchSet 884
|Date: 2011/04/06 22:51:31
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|Change so that an empty session name always means the current sessions
|even if given with, for example, -t '', and explicitly forbid empty
|session names and those containing a : when they are created.
2011-04-06 22:29:26 +00:00
Nicholas Marriott 4e452a2e11 |PatchSet 882
|Date: 2011/04/05 20:37:01
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|Add a flag to cmd_find_session so that attach-session can prefer
|unattached sessions when choosing the most recently used (if -t is not
|given). Suggested by claudio@.
2011-04-06 22:24:01 +00:00
Nicholas Marriott ffce6b34b2 |PatchSet 876
|Date: 2011/03/29 20:30:16
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|Change -t on display-message to be target-pane for the #[A-Z]
|replacements and add -c as target-client.
2011-04-06 22:21:02 +00:00
Nicholas Marriott 8ab7fcf7eb |PatchSet 873
|Date: 2011/03/28 20:44:31
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|Style: uint -> u_int and a missing else.
2011-04-06 22:18:56 +00:00
Nicholas Marriott 2b508f7f6b |PatchSet 871
|Date: 2011/03/27 21:31:25
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|Don't include meta twice when working out the flags to output for
|xterm-style keys - bit 3 is accepted on input but not on output. Also a
|style nit in the header.
2011-04-06 22:17:33 +00:00
Nicholas Marriott 536fc24653 PatchSet 870
Date: 2011/03/27 21:27:26
Author: nicm
Branch: HEAD
Tag: (none)
Log:
Give each pane created in a tmux server a unique id (starting from 0),
put it in the TMUX_PANE environment variable and accept it as a
target. Suggested by and with testing and tweaks from Ben Boeckel.
2011-04-06 22:16:33 +00:00
Nicholas Marriott ec89eb9552 Change so that an empty session name always means the current sessions
even if given with, for example, -t '', and explicitly forbid empty
session names and those containing a : when they are created.
2011-04-06 21:51:31 +00:00
Nicholas Marriott 5d519ba526 Add a flag to cmd_find_session so that attach-session can prefer
unattached sessions when choosing the most recently used (if -t is not
given). Suggested by claudio@.
2011-04-05 19:37:01 +00:00
Nicholas Marriott d88c20e718 Change -t on display-message to be target-pane for the #[A-Z]
replacements and add -c as target-client.
2011-03-29 19:30:16 +00:00
Nicholas Marriott fa6abac98d Style: uint -> u_int and a missing else. 2011-03-28 19:44:31 +00:00
Nicholas Marriott 7ce8fee4f3 Don't include meta twice when working out the flags to output for
xterm-style keys - bit 3 is accepted on input but not on output. Also a
style nit in the header.
2011-03-27 20:31:25 +00:00
Nicholas Marriott 808502ac3d Give each pane created in a tmux server a unique id (starting from 0),
put it in the TMUX_PANE environment variable and accept it as a
target. Suggested by and with testing and tweaks from Ben Boeckel.
2011-03-27 20:27:26 +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 d0cca3924e Sync OpenBSD patchset 863:
Add a -P option to detach to HUP the client's parent process (usually
causing it to exit as well).
2011-03-19 23:27:35 +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 7954126dcd Add a -P option to detach to HUP the client's parent process (usually
causing it to exit as well).
2011-03-03 08:51:47 +00:00
Tiago Cunha 3d7b8105e1 Sync OpenBSD patchset 855:
Simplify the way jobs work and drop the persist type, so all jobs are
fire-and-forget.

Status jobs now managed with two trees of output (new and old), rather
than storing the output in the jobs themselves. When the status line is
processed any jobs which don't appear in the new tree are started and
the output from the old tree displayed. When a job finishes it updates
the new tree with its output and that is used for any subsequent
redraws. When the status interval expires, the new tree is moved to the
old so that all jobs are run again.

This fixes the "#(echo %H:%M:%S)" problem which would lead to thousands
of identical persistent jobs and high memory use (this can still be
achieved by adding "sleep 30" but that is much less likely to happen by
accident).
2011-02-15 15:20:03 +00:00
Tiago Cunha 3b56ebce6d Sync OpenBSD patchset 854:
Use LIST_* not SLIST_*.
2011-02-15 15:12:28 +00:00
Tiago Cunha 2ab568fa88 Sync OpenBSD patchset 853:
When clearing the entire screen, clear lines that are used into the
history like xterm does. Requested ages ago by someone I've forgotten.
2011-02-15 15:10:47 +00:00
Tiago Cunha 4e4568cade Sync OpenBSD patchset 852:
Check if the index is in use and fail before creating the child process,
rather than leaving a stray child on failure.
2011-02-15 15:09:52 +00:00
Tiago Cunha d0d1c0e486 Sync OpenBSD patchset 848:
Set $TMUX without the session when background jobs are run.
2011-02-14 23:11:33 +00:00
Nicholas Marriott db7a89b1ee Simplify the way jobs work and drop the persist type, so all jobs are
fire-and-forget.

Status jobs now managed with two trees of output (new and old), rather
than storing the output in the jobs themselves. When the status line is
processed any jobs which don't appear in the new tree are started and
the output from the old tree displayed. When a job finishes it updates
the new tree with its output and that is used for any subsequent
redraws. When the status interval expires, the new tree is moved to the
old so that all jobs are run again.

This fixes the "#(echo %H:%M:%S)" problem which would lead to thousands
of identical persistent jobs and high memory use (this can still be
achieved by adding "sleep 30" but that is much less likely to happen by
accident).
2011-01-26 01:54:56 +00:00
Nicholas Marriott 4dfb29fa38 Use LIST_* not SLIST_*. 2011-01-26 00:11:47 +00:00
Nicholas Marriott ecc22c521d When clearing the entire screen, clear lines that are used into the
history like xterm does. Requested ages ago by someone I've forgotten.
2011-01-25 23:40:26 +00:00
Nicholas Marriott 1270f8fed8 Check if the index is in use and fail before creating the child process,
rather than leaving a stray child on failure.
2011-01-25 22:31:50 +00:00
Nicholas Marriott b8023044c3 Set $TMUX without the session when background jobs are run. 2011-01-23 11:03:43 +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
Tiago Cunha 492e3aa437 Sync OpenBSD patchset 834:
Move all calls to fcntl(...O_NONBLOCK) into a function and clear the
flag on the stdio file descriptors before closing them (fixes things
like "tmux ls && cat").
2011-01-21 23:44:13 +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
Nicholas Marriott 69cb1f830e Move all calls to fcntl(...O_NONBLOCK) into a function and clear the
flag on the stdio file descriptors before closing them (fixes things
like "tmux ls && cat").
2011-01-08 01:52:36 +00:00
Tiago Cunha 30f6d9b167 Sync OpenBSD patchset 813:
Add a function to create window flags rather than doing the same thing
in two places. From Thomas Adam.
2011-01-07 16:55:40 +00:00
Tiago Cunha 1df427bc7b Sync OpenBSD patchset 829:
Clean up and simplify tmux command argument parsing.

Originally, tmux commands were parsed in the client process into a
struct with the command data which was then serialised and sent to the
server to be executed. The parsing was later moved into the server (an
argv was sent from the client), but the parse step and intermediate
struct was kept.

This change removes that struct and the separate parse step. Argument
parsing and printing is now common to all commands (in arguments.c) with
each command left with just an optional check function (to validate the
arguments at parse time), the exec function and a function to set up any
key bindings (renamed from the old init function).

This is overall more simple and consistent.

There should be no changes to any commands behaviour or syntax although
as this touches every command please watch for any unexpected changes.
2011-01-07 14:45:34 +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 7502cb3adb Clean up and simplify tmux command argument parsing.
Originally, tmux commands were parsed in the client process into a
struct with the command data which was then serialised and sent to the
server to be executed. The parsing was later moved into the server (an
argv was sent from the client), but the parse step and intermediate
struct was kept.

This change removes that struct and the separate parse step. Argument
parsing and printing is now common to all commands (in arguments.c) with
each command left with just an optional check function (to validate the
arguments at parse time), the exec function and a function to set up any
key bindings (renamed from the old init function).

This is overall more simple and consistent.

There should be no changes to any commands behaviour or syntax although
as this touches every command please watch for any unexpected changes.
2011-01-04 00:42:46 +00:00
Tiago Cunha 36c7c7537a Sync OpenBSD patchset 826:
Move the user-visible parts of all options (names, types, limit, default
values) together into one set of tables in options-table.c. Also clean
up and simplify cmd-set-options.c and move a common print function into
option-table.c.
2011-01-03 23:52:38 +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 521247bedb Sync OpenBSD patchset 823:
Sprinkle a little more const.
2011-01-03 23:31:26 +00:00
Tiago Cunha 9ad028e8ee Sync OpenBSD patchset 822:
Another table that should be const.
2011-01-03 23:30:43 +00:00
Tiago Cunha d3c04b74ec Sync OpenBSD patchset 819:
Don't reset the activity timer for unattached sessions every second,
this screws up the choice of most-recently-used. Instead, break the time
update into a little function and do it when the session is attached.

Pointed out by joshe@.
2011-01-03 23:27:54 +00:00
Nicholas Marriott 3e8124009f Move the user-visible parts of all options (names, types, limit, default
values) together into one set of tables in options-table.c. Also clean
up and simplify cmd-set-options.c and move a common print function into
option-table.c.
2011-01-01 16:51:21 +00:00
Nicholas Marriott 67ee86085c Sprinkle a little more const. 2011-01-01 03:39:21 +00:00
Nicholas Marriott 5d0cfe079b Another table that should be const. 2011-01-01 03:32:28 +00:00
Nicholas Marriott 04b32fa734 Don't reset the activity timer for unattached sessions every second,
this screws up the choice of most-recently-used. Instead, break the time
update into a little function and do it when the session is attached.

Pointed out by joshe@.
2011-01-01 01:12:09 +00:00
Nicholas Marriott f71b3054cd Switch tmux to use autoconf and automake.
Although they suck, they suck less than the alternatives.
2010-12-31 22:12:33 +00:00
Tiago Cunha f72f21951c Sync OpenBSD patchset 816:
Remove some unused defines.
2010-12-31 01:59:47 +00:00
Nicholas Marriott 4fb1045f5a Remove some unused defines. 2010-12-30 23:20:13 +00:00
Nicholas Marriott cc42614fa9 Change from a per-session stack of buffers to one global stack which is
much more convenient and also simplifies lot of code. This renders
copy-buffer useless and makes buffer-limit now a server option.

By Tiago Cunha.
2010-12-30 23:16:18 +00:00
Tiago Cunha 9ebee6aef8 Global paste buffers instead of per-session which renders copy-buffer useless.
As a consequence buffer-limit is now a server option.
2010-12-30 22:39:49 +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 2231e72968 Add a function to create window flags rather than doing the same thing
in two places. From Thomas Adam.
2010-12-30 21:35:17 +00:00
Nicholas Marriott 436f3b357e epoll on Linux is broken with /dev/null so it needs to be disabled.
Instead of adding another BROKEN_* define, move event_init into
osdep-*.c.
2010-12-30 20:41:08 +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 a373235106 Sync OpenBSD patchset 806:
Store sessions in an RB tree by name rather than a list, this is tidier
and allows them to easily be shown sorted in various lists
(list-sessions/choose-sessions).

Keep a session index which is used in a couple of places internally but
make it an ever-increasing number rather than filling in gaps with new
sessions.
2010-12-22 15:36:44 +00:00
Tiago Cunha a932742a8a Sync OpenBSD patchset 803:
Dead sessions are never on the active sessions list, so the SESSION_DEAD
flag is effectively unused. Remove it.
2010-12-22 15:31:56 +00:00
Tiago Cunha bb728b89a7 Sync OpenBSD patchset 802:
Use pointer rather than index for the client's last session.
2010-12-22 15:31:00 +00:00
Tiago Cunha 64d16cf2d6 Sync OpenBSD patchset 801:
Unify the way sessions are used by callbacks - store the address and use
the reference count, then check it is still on the global sessions list
in the callback.
2010-12-22 15:28:51 +00:00
Nicholas Marriott acf13ce978 Store sessions in an RB tree by name rather than a list, this is tidier
and allows them to easily be shown sorted in various lists
(list-sessions/choose-sessions).

Keep a session index which is used in a couple of places internally but
make it an ever-increasing number rather than filling in gaps with new
sessions.
2010-12-21 22:37:59 +00:00
Nicholas Marriott 8705c6b435 Dead sessions are never on the active sessions list, so the SESSION_DEAD
flag is effectively unused. Remove it.
2010-12-20 00:19:20 +00:00
Nicholas Marriott 9358cfaf4a Use pointer rather than index for the client's last session. 2010-12-20 00:17:22 +00:00
Nicholas Marriott a51dcdc430 Unify the way sessions are used by callbacks - store the address and use
the reference count, then check it is still on the global sessions list
in the callback.
2010-12-20 00:03:55 +00:00
Nicholas Marriott 5fcd6711e4 Track the last session for a client and add a flag to switch-client and
a key binding (L) to move a client back to its last session.
2010-12-11 18:42:20 +00:00
Nicholas Marriott 51487ed22f Track the last session for a client and add a flag to switch-client and
a key binding (L) to move a client back to its last session.
2010-12-11 18:39:25 +00:00
Nicholas Marriott 095ffe9cd1 Make the prompt history global for all clients which is much more useful
than per-client history.
2010-12-11 16:15:02 +00:00
Nicholas Marriott 7ce77ffc9c Make the prompt history global for all clients which is much more useful than per-client history. 2010-12-11 16:05:57 +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
Nicholas Marriott e75187310d PatchSet 789
Date: 2010/11/22 21:13:13
Author: nicm
Branch: HEAD
Tag: (none)
Log:
There is somewhere that WINDOW_HIDDEN is getting set when it shouldn't
be and I can't find it, but the flag itself is a useless optimisation
that only applies to automatic-resize windows, so just dispose of it
entirely.

Fixes problems reported by Nicholas Riley.

Members:
        resize.c:1.5->1.6
        tmux.h:1.246->1.247
        tty.c:1.92->1.93
2010-12-06 21:57:56 +00:00
Nicholas Marriott 3a4b82d27a PatchSet 783
Date: 2010/11/11 20:51:30
Author: nicm
Branch: HEAD
Tag: (none)
Log:
Declaration in header should be extern.

Members:
        tmux.h:1.245->1.246
2010-12-06 21:50:24 +00:00
Nicholas Marriott 39e277be3c |---------------------
|PatchSet 781
|Date: 2010/10/29 21:11:57
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|We now send argv to the server after parsing it in the client to get the
|command, so the client should not modify it. Instead, take a copy. Fixes
|parsing command lists, reported by mcbride@.
|
|Members:
|       cmd-list.c:1.5->1.6
|       cmd.c:1.45->1.46
|       tmux.h:1.244->1.245
2010-12-06 21:48:56 +00:00
Nicholas Marriott ef9b2eb566 There is somewhere that WINDOW_HIDDEN is getting set when it shouldn't
be and I can't find it, but the flag itself is a useless optimisation
that only applies to automatic-resize windows, so just dispose of it
entirely.

Fixes problems reported by Nicholas Riley.
2010-11-22 21:13:13 +00:00
Nicholas Marriott c7fccfa299 Declaration in header should be extern. 2010-11-11 20:51:30 +00:00
Nicholas Marriott 34d05ea7cd We now send argv to the server after parsing it in the client to get the
command, so the client should not modify it. Instead, take a copy. Fixes
parsing command lists, reported by mcbride@.
2010-10-29 20:11:57 +00:00
Tiago Cunha cd079e8fbf Sync OpenBSD patchset 780:
Add a last-pane command (bound to ; by default). Requested ages ago by
somebody whose name I have forgotten.
2010-10-24 01:34:30 +00:00
Tiago Cunha bdbd4e28c2 Sync OpenBSD patchset 777:
Merge the before and after attach client code into one in client.c
(instead of two in tmux.c and client.c).
2010-10-24 01:31:08 +00:00
Nicholas Marriott 5de84eca3d Add a last-pane command (bound to ; by default). Requested ages ago by
somebody whose name I have forgotten.
2010-10-23 13:04:34 +00:00
Nicholas Marriott 248fb14f08 Merge the before and after attach client code into one in client.c
(instead of two in tmux.c and client.c).
2010-10-18 20:00:02 +00:00
Tiago Cunha 45784bd5d6 Sync OpenBSD patchset 767:
Nuke a leftover RB tree declaration spotted by blambert.
2010-10-09 14:30:26 +00:00
Tiago Cunha b5349ab5d9 Sync OpenBSD patchset 766:
Two new options:

- server option "exit-unattached" makes the server exit when no clients
  are attached, even if sessions are present;

- session option "destroy-unattached" destroys a session once no clients
  are attached to it.

These are useful for preventing tmux remaining in the background where
it is undesirable and when using tmux as a login shell to keep a limit
on new sessions.
2010-10-09 14:29:32 +00:00
Nicholas Marriott 4789a4ee1f Nuke a leftover RB tree declaration spotted by blambert. 2010-09-28 07:15:45 +00:00
Nicholas Marriott 9a7cde0c9b Two new options:
- server option "exit-unattached" makes the server exit when no clients
  are attached, even if sessions are present;

- session option "destroy-unattached" destroys a session once no clients
  are attached to it.

These are useful for preventing tmux remaining in the background where
it is undesirable and when using tmux as a login shell to keep a limit
on new sessions.
2010-09-26 20:43:30 +00:00
Tiago Cunha 5126037ea0 Sync OpenBSD patchset 762:
Use UTF-8 line drawing characters on UTF-8 terminals. Fixes some stupid
terminals (I'm looking at you, putty) which disable the vt100 ACS mode
switching sequences in UTF-8 mode.

Also on terminals without ACS at all, use ASCII equivalents where
obvious.
2010-09-18 15:43:53 +00:00
Nicholas Marriott cb564bb427 Use UTF-8 line drawing characters on UTF-8 terminals. Fixes some stupid
terminals (I'm looking at you, putty) which disable the vt100 ACS mode
switching sequences in UTF-8 mode.

Also on terminals without ACS at all, use ASCII equivalents where
obvious.
2010-09-11 16:19:22 +00:00
Tiago Cunha 89c07dedd9 Sync OpenBSD patchset 759:
Add -n and -p flags to switch-client to move to the next and previous
session (yes, it doesn't match window/pane, but so what, nor does
switch-client).

Based on a diff long ago from "edsouza".
2010-09-10 13:36:17 +00:00
Nicholas Marriott a22a6deda5 Add -n and -p flags to switch-client to move to the next and previous
session (yes, it doesn't match window/pane, but so what, nor does
switch-client).

Based on a diff long ago from "edsouza".
2010-09-08 22:02:28 +00:00
Nicholas Marriott f54482a461 Solaris 9 has no stdint.h, ugh. Reported by a couple of people most
recently Timothy Larson.
2010-09-07 19:32:58 +00:00
Tiago Cunha 56040be346 Sync OpenBSD patchset 751:
Do not call event_del() for signals after fork(), just use sigaction()
directly instead - calling libevent functions after fork() w/o
event_reinit() is a bad idea, even if in this case it was harmless.
2010-08-29 14:42:11 +00:00
Nicholas Marriott e3be9b1951 Do not call event_del() for signals after fork(), just use sigaction()
directly instead - calling libevent functions after fork() w/o
event_reinit() is a bad idea, even if in this case it was harmless.
2010-08-19 18:29:01 +00:00
Tiago Cunha 761bd3c9e3 Sync OpenBSD patchset 745:
Change the way backoff works. Instead of stopping reading from the pty
when the client tty backs up too much, just stop updating the tty and
only update the internal screen. Then when the tty recovers, force a
redraw.

This prevents a dodgy client from causing other clients to go into
backoff while still allowing tmux to be responsive (locally) when seeing
lots of output.
2010-08-11 22:16:04 +00:00
Nicholas Marriott 8363e31953 Change the way backoff works. Instead of stopping reading from the pty
when the client tty backs up too much, just stop updating the tty and
only update the internal screen. Then when the tty recovers, force a
redraw.

This prevents a dodgy client from causing other clients to go into
backoff while still allowing tmux to be responsive (locally) when seeing
lots of output.
2010-08-11 07:34:43 +00:00
Tiago Cunha d7bae0edce Sync OpenBSD patchset 741:
When changing so that the client passes its stdout and stderr as well as
stdin up to the server, I forgot one essential point - the tmux server
could now be both the producer and consumer. This happens when tmux is
run inside tmux, as well as when piping tmux commands together.

So, using stdio(3) was a bad idea - if sufficient data was written, this
could block in write(2). When that happened and the server was both
producer and consumer, it deadlocks.

Change to use libevent bufferevents for the client stdin, stdout and
stderr instead. This is trivial enough for output but requires a
callback mechanism to trigger when stdin is finished.

This relies on the underlying polling mechanism for libevent to work
with whatever devices to which the user could redirect stdin, stdout or
stderr, hence the change to use poll(2) over kqueue(2) for tmux.
2010-08-09 21:44:25 +00:00
Nicholas Marriott c87187f913 When changing so that the client passes its stdout and stderr as well as
stdin up to the server, I forgot one essential point - the tmux server
could now be both the producer and consumer. This happens when tmux is
run inside tmux, as well as when piping tmux commands together.

So, using stdio(3) was a bad idea - if sufficient data was written, this
could block in write(2). When that happened and the server was both
producer and consumer, it deadlocks.

Change to use libevent bufferevents for the client stdin, stdout and
stderr instead. This is trivial enough for output but requires a
callback mechanism to trigger when stdin is finished.

This relies on the underlying polling mechanism for libevent to work
with whatever devices to which the user could redirect stdin, stdout or
stderr, hence the change to use poll(2) over kqueue(2) for tmux.
2010-07-24 20:11:59 +00:00
Tiago Cunha 11f81e8134 Sync OpenBSD patchset 735:
Make pane/window wrapping more logical (so with 10 windows, +10 from
window 5 stays in the same place), and tidy the code. From Tiago Cunha.
2010-07-17 14:38:13 +00:00
Tiago Cunha ad6a528f61 Sync OpenBSD patchset 734:
Return the command client return code with MSG_EXIT now that MSG_ERROR and
MSG_PRINT are unused.

New clients should be compatible with old tmux servers but vice versa may print
an error.
2010-07-17 14:36:41 +00:00
Nicholas Marriott 43355fa75c Make pane/window wrapping more logical (so with 10 windows, +10 from
window 5 stays in the same place), and tidy the code. From Tiago Cunha.
2010-07-14 18:37:49 +00:00
Nicholas Marriott b9c873cdaa Return the command client return code with MSG_EXIT now that MSG_ERROR and
MSG_PRINT are unused.

New clients should be compatible with old tmux servers but vice versa may print
an error.
2010-07-11 17:06:45 +00:00
Tiago Cunha 46f27eab22 Sync OpenBSD patchset 733:
replace some magic mouse constants with defines for clarity. ok nicm
2010-07-02 02:56:07 +00:00
Tiago Cunha e4703bacb5 Sync OpenBSD patchset 732:
Custom layouts. list-windows command displays the layout as a string (such as
"bb62,159x48,0,0{79x48,0,0,79x48,80,0}") and it can be applied to another
window (with the same number of panes or fewer) using select-layout.
2010-07-02 02:54:52 +00:00
Tiago Cunha e4573de97b Sync OpenBSD patchset 731:
Send all three of stdin, stdout, stderr from the client to the server, so that
commands can directly make use of them. This means that load-buffer and
save-buffer can have "-" as the file to read from stdin or write to stdout.

This is a protocol version bump so the tmux server will need to be restarted
after upgrade (or an older client used).
2010-07-02 02:52:13 +00:00
Tiago Cunha 63e76b555d Sync OpenBSD patchset 730:
Store the current working directory in the session, change the default-path
option to default to empty and make that mean that the stored session CWD is
used.
2010-07-02 02:49:19 +00:00
Tiago Cunha 03c1c1cd9f Sync OpenBSD patchset 727:
Setting the cmdlist pointer in the bind-key to NULL to prevent it being freed
after the command is executing is bogus because it may still be needed if the
same command is going to be executed again (for example if you "bind-key a
bind-key b ..."). Making a copy is hard, so instead add a reference count to
the cmd_list.

While here, also print bind-key -n and the rest of the flags properly.

Fixes problem reported by mcbride@.
2010-07-02 02:43:01 +00:00
Ted Unangst b4b9b831ee replace some magic mouse constants with defines for clarity. ok nicm 2010-06-29 05:24:49 +00:00
Nicholas Marriott 552c9cd83f Custom layouts. list-windows command displays the layout as a string (such as
"bb62,159x48,0,0{79x48,0,0,79x48,80,0}") and it can be applied to another
window (with the same number of panes or fewer) using select-layout.
2010-06-29 03:30:13 +00:00
Nicholas Marriott 76bbdeb586 Send all three of stdin, stdout, stderr from the client to the server, so that
commands can directly make use of them. This means that load-buffer and
save-buffer can have "-" as the file to read from stdin or write to stdout.

This is a protocol version bump so the tmux server will need to be restarted
after upgrade (or an older client used).
2010-06-28 22:10:42 +00:00
Nicholas Marriott 07a71fd432 Store the current working directory in the session, change the default-path
option to default to empty and make that mean that the stored session CWD is
used.
2010-06-27 02:56:59 +00:00
Nicholas Marriott 42e2413978 Setting the cmdlist pointer in the bind-key to NULL to prevent it being freed
after the command is executing is bogus because it may still be needed if the
same command is going to be executed again (for example if you "bind-key a
bind-key b ..."). Making a copy is hard, so instead add a reference count to
the cmd_list.

While here, also print bind-key -n and the rest of the flags properly.

Fixes problem reported by mcbride@.
2010-06-26 18:20:53 +00:00
Tiago Cunha bf1e237410 Sync OpenBSD patchset 726:
Add a choose-buffer command for easier use of the paste buffer stack.
2010-06-22 23:35:20 +00:00
Tiago Cunha 8d3b726396 Sync OpenBSD patchset 725:
Extend the -t:+ and -t:- window targets for next and previous window to
accept an offset such as -t:+2. From Tiago Cunha.
2010-06-22 23:29:05 +00:00
Tiago Cunha 47b335dee7 Sync OpenBSD patchset 724:
Having a list of winlinks->alerts for each session is stupid, just store
the alert flags directly in the winlink itself.
2010-06-22 23:26:18 +00:00
Nicholas Marriott ef7293379f Add a choose-buffer command for easier use of the paste buffer stack. 2010-06-21 21:44:09 +00:00
Nicholas Marriott 386849edc1 Extend the -t:+ and -t:- window targets for next and previous window to
accept an offset such as -t:+2. From Tiago Cunha.
2010-06-21 01:46:36 +00:00
Nicholas Marriott e63f0546a1 Having a list of winlinks->alerts for each session is stupid, just store
the alert flags directly in the winlink itself.
2010-06-21 01:27:46 +00:00
Nicholas Marriott dcc100f165 Use a macro-based mask for obtaining a key or modifier-set from the
combination. Display C-@, etc, as C-Space, in list-keys. By Micah Cowan.
2010-06-06 19:00:13 +00:00
Tiago Cunha 6503207185 Sync OpenBSD patchset 716:
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-06 00:30:34 +00:00
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
Micah Cowan 227e458ebb Use a macro-based mask for obtaining a key or modifier-set from the combination.
Display C-@, etc, as C-Space, in list-keys.
2010-06-05 20:29:11 +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 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
Nicholas Marriott 1618f3eae6 Move imsg into libutil and add a man page.
Minor bump for libutil.

Previous versions of this diff and man page looked at by various people.

"you should just commit" deraadt
2010-05-26 16:44:32 +00:00
Nicholas Marriott 4f5c5b37b8 Pass in the session, rather than the client, to window modes' key()
function. We were only ever using the client to find the session anyway.

This allows send-key to work properly for manipulating copy mode from
outside tmux.

From Micah Cowan.
2010-05-23 19:42:19 +00:00
Micah Cowan f11f71752a Pass in the session, rather than the client, to window modes' key() function.
We were only ever using the client to find the session anyway.
2010-05-22 21:56:04 +00:00
Tiago Cunha 9900e28ba8 Sync OpenBSD patchset 697:
Identical behaviour to select-prompt can now be obtained with
command-prompt, so remove select-prompt and change ' to be bound to
command-prompt -p index "select-window -t :%%".
2010-05-14 14:33:39 +00:00
Tiago Cunha fc69b9ccb7 Sync OpenBSD patchset 696:
Make signal handler setup/teardown two common functions instead of six,
and reset SIGCHLD after fork to fix problems with some shells. From
Romain Francoise.
2010-05-14 14:30:01 +00:00
Nicholas Marriott e0f4697e7c Identical behaviour to select-prompt can now be obtained with
command-prompt, so remove select-prompt and change ' to be bound to
command-prompt -p index "select-window -t :%%".
2010-05-05 23:24:23 +00:00
Nicholas Marriott c4a2fdf15b Put this back in with the initialisation in the right order. 2010-05-04 17:28:16 +00:00
Nicholas Marriott af5e0bd15a Revert last change, it appears to be broken somehow. 2010-05-04 08:48:06 +00:00
Nicholas Marriott ec1d37b1b2 Make signal handler setup/teardown two common functions instead of six,
and reset SIGCHLD after fork to fix problems with some shells. From
Romain Francois.
2010-05-03 16:06:32 +00:00
Nicholas Marriott 0fc65537a3 Run job commands explicitly in the global enviroment (which can be
modified with setenv -g) rather than with the environment tmux started
with.
2010-04-06 21:59:19 +00:00
Nicholas Marriott 091db41bc9 Squash a function that is only called in a callback into the
callback function.
2010-04-06 21:58:33 +00:00
Nicholas Marriott 67300e9524 Stupid style nits. 2010-04-06 21:45:36 +00:00
Nicholas Marriott ac9daf92d7 Merge copy mode and output mode, dropping the latter. Idea and code from
Micah Cowan.
2010-04-06 21:35:44 +00:00
Micah Cowan 2d74ce1d3a Merge output (more) and copy modes into one single mode (called copy). 2010-04-05 05:11:44 +00:00
Nicholas Marriott b02cd35354 Run job commands explicitly in the global enviroment (which can be
modified with setenv -g) rather than with the environment tmux started
with.
2010-04-04 19:02:09 +00:00
Nicholas Marriott 7425122c1c Squash a function that is only called in a callback into the callback
function.
2010-04-04 18:48:37 +00:00
Nicholas Marriott 4012917302 Nuke unused functions. 2010-03-27 15:12:56 +00:00
Nicholas Marriott c550e66e85 Dead functions, lint. 2010-03-22 19:18:46 +00:00
Nicholas Marriott 0ac6efa6d5 Add vi-style "jump" commands for copy mode, from Micah Cowan. 2010-03-22 19:10:42 +00:00
Nicholas Marriott 6f04866044 Support up, down, left, right movement through panes with -UDLR flags to
select-pane.

Also REMOVE the up- and down-pane commands: equivalent behaviour is now
available using -t :.+ and -t :.-.
2010-03-22 19:07:52 +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
Micah Cowan 009d8d2ea7 Jump-forward, jump-backward in copy mode, based on vi's F and f commands. 2010-03-16 17:30:58 +00:00
Nicholas Marriott aa8f9018ea Support up, down, left, right movement through panes with -UDLR flags to
select-pane.

Also remove up- and down-pane: equivalent behaviour is now available
using -t :.+ and -t :.-.
2010-03-15 22:03:38 +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 b34c8f5f39 Sync OpenBSD patchset 658:
Permit keys in copy mode to be prefixed by a repeat count, entered with
[1-9] in vi mode, or M-[1-9] in emacs mode.

From Micah Cowan, tweaked a little by me.
2010-03-08 15:02:07 +00:00
Nicholas Marriott 7bc3f5dd8a Permit keys in copy mode to be prefixed by a repeat count, entered with
[1-9] in vi mode, or M-[1-9] in emacs mode.

From Micah Cowan, tweaked a little by me.
2010-03-02 00:32:41 +00:00
Tiago Cunha ecac081a55 Sync OpenBSD patchset 648:
copy mode uses the real screen as backing and if it is updated while copying,
strange things can happen. So, freeze reading from the pty while in copy mode.
2010-02-26 13:26:44 +00:00
Nicholas Marriott 3a89d1ef7f copy mode uses the real screen as backing and if it is updated while copying,
strange things can happen. So, freeze reading from the pty while in copy mode.
2010-02-19 00:03:21 +00:00
Tiago Cunha 66c38d8c5d Sync OpenBSD patchset 644:
Add "N" key to search the opposite way from the last search (reverse of "n"),
from Micah Cowan.
2010-02-18 12:35:16 +00:00
Nicholas Marriott 44ded35d5d Add "N" key to search the opposite way from the last search (reverse of "n"),
from Micah Cowan.
2010-02-11 20:39:40 +00:00
Tiago Cunha 36a80b2cd6 Sync OpenBSD patchset 640:
Use the array.h code for the causes list.
2010-02-08 18:29:32 +00:00
Tiago Cunha c6ba781379 Sync OpenBSD patchset 639:
Support attaching a client read-only with a new -r flag to the attach-session
command.
2010-02-08 18:27:34 +00:00
Tiago Cunha 3c37b09272 Sync OpenBSD patchset 636:
Rectangle copy support, from Robin Lee Powell.
2010-02-08 18:13:17 +00:00
Tiago Cunha a32d095c97 Sync OpenBSD patchset 635:
Instead of bailing out on the first configuration file error, carry on,
collecting all the errors, then start with the active window in more mode
displaying them.
2010-02-08 18:10:07 +00:00
Nicholas Marriott 4651180503 Use the array.h code for the causes list. 2010-02-06 23:22:27 +00:00
Nicholas Marriott bb53c20c18 Support attaching a client read-only with a new -r flag to the attach-session
command.
2010-02-06 22:55:31 +00:00
Nicholas Marriott 3ef3802629 Rectangle copy support, from Robin Lee Powell. 2010-02-06 17:35:01 +00:00
Nicholas Marriott 8aba77b7be Instead of bailing out on the first configuration file error, carry on,
collecting all the errors, then start with the active window in more mode
displaying them.
2010-02-06 17:15:33 +00:00
Tiago Cunha fa5be75396 Sync OpenBSD patchset 634:
vi-style B, W and E keys in copy mode to navigate between words treating only
spaces as word separators. Also add . to the list of word separators for
standard word navigation.

From Micah Cowan, tweaked slightly by me.
2010-02-05 01:34:08 +00:00
Nicholas Marriott 5e6a7c85cc vi-style B, W and E keys in copy mode to navigate between words treating only
spaces as word separators. Also add . to the list of word separators for
standard word navigation.

From Micah Cowan, tweaked slightly by me.
2010-02-04 20:00:26 +00:00
Tiago Cunha c4724c7861 Sync OpenBSD patchset 629:
Add scroll-up/scroll-down for choose/more mode, from Micah Cowan.
2010-02-02 23:55:21 +00:00
Nicholas Marriott 06ce9da32a Add scroll-up/scroll-down for choose/more mode, from Micah Cowan. 2010-02-01 22:15:51 +00:00
Tiago Cunha 735cfaf09a Sync OpenBSD patchset 621:
Alter next-word to have vi-like movement behaviour, and add next-word-end with
the existing emacs behaviour. From Micah Cowan.
2010-01-28 22:45:57 +00:00
Tiago Cunha c153a43299 Sync OpenBSD patchset 617:
Top/bottom of history mode keys, diff from Micah Cowan, tweaked by me.
2010-01-28 22:41:45 +00:00
Nicholas Marriott 3e2cc2d2c4 Alter next-word to have vi-like movement behaviour, and add next-word-end with
the existing emacs behaviour. From Micah Cowan.
2010-01-27 20:18:52 +00:00
Nicholas Marriott 1e5a94fdb5 Top/bottom of history mode keys, diff from Micah Cowan, tweaked by me. 2010-01-25 21:33:39 +00:00
Tiago Cunha da194cc435 Sync OpenBSD patchset 604:
New command, join-pane, to split and move an existing pane into the space (like
splitw then movep, or the reverse of breakp).
2010-01-08 16:31:35 +00:00
Nicholas Marriott 6a45fab608 New command, join-pane, to split and move an existing pane into the space (like
splitw then movep, or the reverse of breakp).
2010-01-07 20:52:18 +00:00
Tiago Cunha 106011aa53 Sync OpenBSD patchset 597:
Options to set the colour of the pane borders, with different colours for the
active pane.
2010-01-05 23:52:37 +00:00
Nicholas Marriott 7e4f8b45b6 Options to set the colour of the pane borders, with different colours for the
active pane.
2010-01-03 12:51:05 +00:00
Tiago Cunha 9fea75149a Sync OpenBSD patchset 590:
Allow keys to be replaced and reorder the table so that terminfo-defined keys
(or terminal-overrides) take precedence over internally defined.
2009-12-18 18:57:00 +00:00
Nicholas Marriott 19ea306606 Allow keys to be replaced and reorder the table so that terminfo-defined keys
(or terminal-overrides) take precedence over internally defined.
2009-12-17 17:39:56 +00:00
Tiago Cunha 90d40e27da Sync OpenBSD patchset 587:
New server option, escape-time, to set the timeout used to detect if escapes
are alone or part of a function key or meta sequence.
2009-12-16 01:09:01 +00:00
Nicholas Marriott 30962cb200 New server option, escape-time, to set the timeout used to detect if escapes
are alone or part of a function key or meta sequence.
2009-12-14 10:43:41 +00:00
Tiago Cunha dcdd2fb094 Sync OpenBSD patchset 585:
Add "server options" which are server-wide and not bound to a session or
window. Set and displayed with "set -s" and "show -s".

Currently the only option is "quiet" (like command-line -q, allowing it to be
set from .tmux.conf), but others will come along.
2009-12-10 16:59:02 +00:00
Tiago Cunha 328861e330 Sync OpenBSD patchset 584:
Permit panes to be referred to as "top", "bottom", "top-left" etc, if the right
pane can be identified.
2009-12-10 16:52:58 +00:00
Nicholas Marriott a4c9a80dac Add "server options" which are server-wide and not bound to a session or
window. Set and displayed with "set -s" and "show -s".

Currently the only option is "quiet" (like command-line -q, allowing it to be
set from .tmux.conf), but others will come along.
2009-12-10 09:16:52 +00:00
Nicholas Marriott 6311bd119e Permit panes to be referred to as "top", "bottom", "top-left" etc, if the right
pane can be identified.
2009-12-08 07:49:31 +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 1caa73afb4 Sync OpenBSD patchset 580:
Eliminate duplicate code and ease the passage for server-wide options by adding
a -w flag to set-option and show-options and making setw and showw aliases to
set -w and show -w.

Note: setw and showw are still there, but now aliases for set -w and show -w.
2009-12-04 22:11:23 +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 6c9862662f Eliminate duplicate code and ease the passage for server-wide options by adding
a -w flag to set-option and show-options and making setw and showw aliases to
set -w and show -w.

Note: setw and showw are still there, but now aliases for set -w and show -w.
2009-12-03 17:44:02 +00:00
Tiago Cunha 55f51c4949 Sync OpenBSD patchset 577:
New command, capture-pane, which copies the entire pane contents to a paste
buffer. From Jonathan Alvarado.
2009-12-02 15:10:44 +00:00
Tiago Cunha 97350cd883 Sync OpenBSD patchset 575:
Handle partial xterm function key sequences.
2009-12-02 15:06:35 +00:00
Nicholas Marriott 0926a23014 New command, capture-pane, which copies the entire pane contents to a paste
buffer. From Jonathan Alvarado.
2009-12-01 18:42:38 +00:00
Nicholas Marriott 29a5931c6a Handle partial xterm function key sequences. 2009-11-30 16:44:03 +00:00
Tiago Cunha dc57c5bb50 Sync OpenBSD patchset 573:
This doesn't need to be u_int.
2009-11-28 14:57:59 +00:00
Tiago Cunha fabf40b3b3 Sync OpenBSD patchset 569:
Tidy up various bits of the paste code, make the data buffer char * and add
comments.
2009-11-28 14:54:12 +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 635d36f928 Sync OpenBSD patchset 562:
Output the right keys for application and number keypad modes (they were the
wrong way round).
2009-11-28 14:41:17 +00:00
Nicholas Marriott 106ee8f30a This doesn't need to be u_int. 2009-11-26 23:13:47 +00:00
Nicholas Marriott 8cb410c63c Tidy up various bits of the paste code, make the data buffer char * and add
comments.
2009-11-26 22:28:24 +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 094bca5ac3 Output the right keys for application and number keypad modes (they were the
wrong way round).
2009-11-25 12:24:31 +00:00
Tiago Cunha 7a9bfabf7a Sync OpenBSD patchset 554:
Change status line drawing to create the window list in a separate screen and
then copy it into the status line screen. This allows UTF-8 in window names and
fixes some problems with #[] in window-status-format.
2009-11-19 22:37:04 +00:00
Tiago Cunha f9451028c0 Sync OpenBSD patchset 553:
Two new options, window-status-format and window-status-current-format, which
allow the format of each window in the status line window list to be controlled
using similar # sequences as status-left/right.

This diff also moves part of the way towards UTF-8 support in window names but
it isn't quite there yet.
2009-11-19 22:35:10 +00:00
Tiago Cunha 563f34477a Sync OpenBSD patchset 549:
Don't interpret #() for display-message, it usually doesn't make sense and may
leak commands.
2009-11-19 22:25:52 +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
Tiago Cunha acc331c787 Sync OpenBSD patchset 546:
Add a per-client log of status line messages displayed while that client
exists. A new message-limit session option sets the maximum number of entries
and a command, show-messages, shows the log (bound to ~ by default).

This (and prompt history) might be better as a single global log but until
there are global options it is easier for them to be per client.
2009-11-19 22:20:04 +00:00
Nicholas Marriott 33b337f618 Change status line drawing to create the window list in a separate screen and
then copy it into the status line screen. This allows UTF-8 in window names and
fixes some problems with #[] in window-status-format.
2009-11-19 19:47:28 +00:00
Nicholas Marriott 543fb99bc6 Two new options, window-status-format and window-status-current-format, which
allow the format of each window in the status line window list to be controlled
using similar # sequences as status-left/right.

This diff also moves part of the way towards UTF-8 support in window names but
it isn't quite there yet.
2009-11-19 16:22:10 +00:00
Nicholas Marriott ac5b7d518e Don't interpret #() for display-message, it usually doesn't make sense and may
leak commands.
2009-11-19 10:22:06 +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
Nicholas Marriott 8db145da1e Add a per-client log of status line messages displayed while that client
exists. A new message-limit session option sets the maximum number of entries
and a command, show-messages, shows the log (bound to ~ by default).

This (and prompt history) might be better as a single global log but until
there are global options it is easier for them to be per client.
2009-11-18 13:16:33 +00:00
Tiago Cunha a7158784f2 Sync OpenBSD patchset 540:
Tweak a comment and add some spacing.
2009-11-14 17:57:41 +00:00
Tiago Cunha e35f5b35bd Sync OpenBSD patchset 539:
Get rid of the ugly CMD_CHFLAG macro and use a const string (eg "dDU") in the
command entry structs and a couple of functions to check/set the flags.
2009-11-14 17:56:39 +00:00
Tiago Cunha 72bc03ac4c Sync OpenBSD patchset 535:
Destroy panes immediately rather than checking them all every loop.
2009-11-14 17:48:39 +00:00
Nicholas Marriott 10e05f9867 Tweak a comment and add some spacing. 2009-11-13 19:58:32 +00:00
Nicholas Marriott 76ef8770cd Get rid of the ugly CMD_CHFLAG macro and use a const string (eg "dDU") in the
command entry structs and a couple of functions to check/set the flags.
2009-11-13 19:53:28 +00:00
Nicholas Marriott 8e47966225 Destroy panes immediately rather than checking them all every loop. 2009-11-13 17:33:07 +00:00
Tiago Cunha 0986001908 Sync OpenBSD patchset 533:
Zap unused functions, prompted by deraadt.
2009-11-13 16:58:24 +00:00
Tiago Cunha 1b4a76d58f Sync OpenBSD patchset 527:
Only need to chmod +x or -x the socket when a client is created, lost or
attached, rather than every event loop.
2009-11-13 16:51:49 +00:00
Nicholas Marriott 5d397462e4 Zap unused functions, prompted by deraadt. 2009-11-13 07:00:54 +00:00
Nicholas Marriott 2756437f4b Only need to chmod +x or -x the socket when a client is created, lost or
attached, rather than every event loop.
2009-11-11 08:00:42 +00:00
Tiago Cunha 74e742113d Sync OpenBSD patchset 523:
Whoops, this is needed for last commit as well.
2009-11-10 23:31:21 +00:00
Nicholas Marriott b92fcf23fd Whoops, this is needed for last commit as well. 2009-11-10 17:41:35 +00:00
Tiago Cunha 181e1cc711 Sync OpenBSD patchset 513:
Switch the tty key tree over to an (unbalanced) ternary tree which allows
partial matches to be done (they wait for further data or a timer to expire,
like a naked escape).

Mouse and xterm-style keys still expect to be atomic.
2009-11-08 23:32:39 +00:00
Tiago Cunha 7d288e7fd8 Sync OpenBSD patchset 511:
Key flags are only used for initialisation so they are not needed in the main
tty_key struct.
2009-11-08 23:29:34 +00:00
Tiago Cunha 5ac6ea61bd Sync OpenBSD patchset 509:
Now all timers are events, there is no longer any need to wake up every 50 ms -
only wake up when an event happens.
2009-11-08 23:27:58 +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 ac6092c27f Sync OpenBSD patchset 507:
Convert the key repeat timer to an event.
2009-11-08 23:24:59 +00:00
Tiago Cunha ab38d91913 Sync OpenBSD patchset 506:
Change window name change to use a timer event rather than a gettimeofday()
check every loop.
2009-11-08 23:22:24 +00:00
Tiago Cunha 915031b049 Sync OpenBSD patchset 505:
Move status timer check into the global once-per-second timer, this could maybe
be done better but one every second is better than once every 50 ms.
2009-11-08 23:12:35 +00:00
Tiago Cunha 02438c01b7 Sync OpenBSD patchset 504:
Use timeout events for the identify and message timers.
2009-11-08 23:11:23 +00:00
Tiago Cunha bee17719d8 Sync OpenBSD patchset 503:
Don't reenlist the client imsg event every loop, instead have a small function
to it and call it after the event triggers or after a imsg is added.
2009-11-08 23:09:36 +00:00
Tiago Cunha 142962742c Sync OpenBSD patchset 499:
Bye-bye buffer*.c.
2009-11-08 23:05:36 +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
Tiago Cunha cb0bf6a043 Sync OpenBSD patchset 496:
Switch window pane pipe redirect fd over to a bufferevent.
2009-11-08 22:59:53 +00:00
Tiago Cunha 971a7b2fe0 Sync OpenBSD patchset 495:
Switch tty fds over to a bufferevent.
2009-11-08 22:58:38 +00:00
Tiago Cunha 53ef4c2bab Sync OpenBSD patchset 493:
Switch jobs over to use a bufferevent.
2009-11-08 22:56:04 +00:00
Tiago Cunha dd36982ad5 Sync OpenBSD patchset 491:
Initial changes to move tmux to libevent.

This moves the client-side loops are pretty much fully over to event-based only
(tmux.c and client.c) but server-side (server.c and friends) treats libevent as
a sort of clever poll, waking up after every event to run various things.

Moving the server stuff over to bufferevents and timers and so on will come
later.
2009-11-08 22:40:36 +00:00
Nicholas Marriott 80e0158112 Switch the tty key tree over to an (unbalanced) ternary tree which allows
partial matches to be done (they wait for further data or a timer to expire,
like a naked escape).

Mouse and xterm-style keys still expect to be atomic.
2009-11-05 19:29:41 +00:00
Nicholas Marriott a790e16fa2 Key flags are only used for initialisation so they are not needed in the main
tty_key struct.
2009-11-05 10:44:36 +00:00
Nicholas Marriott 38e13942ac Now all timers are events, there is no longer any need to wake up every 50 ms -
only wake up when an event happens.
2009-11-05 08:48:15 +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
Nicholas Marriott 80444436f3 Convert the key repeat timer to an event. 2009-11-05 00:05:00 +00:00
Nicholas Marriott 44d6a2c435 Change window name change to use a timer event rather than a gettimeofday()
check every loop.
2009-11-04 23:54:57 +00:00
Nicholas Marriott 946ed97273 Move status timer check into the global once-per-second timer, this could maybe
be done better but one every second is better than once every 50 ms.
2009-11-04 23:42:51 +00:00
Nicholas Marriott b1264a7416 Use timeout events for the identify and message timers. 2009-11-04 23:29:42 +00:00
Nicholas Marriott b3c4956efe Don't reenlist the client imsg event every loop, instead have a small function
to it and call it after the event triggers or after a imsg is added.
2009-11-04 23:12:43 +00:00
Tiago Cunha 5be38f2b3a Sync OpenBSD patchset 485:
Add an activity time for clients, like for sessions, and change session and
client lookup to pick the most recently used rather than the most recently
created - this is much more useful when used interactively and (because the
activity time is set at creation) should have no effect on source-file.

Based on a problem reported by Jan Johansson.
2009-11-04 22:46:25 +00:00
Nicholas Marriott 5bebbd81d7 Bye-bye buffer*.c. 2009-11-04 22:44:53 +00:00
Tiago Cunha b7fc4f3760 Sync OpenBSD patchset 484:
If it isn't available explicitly, work out the current client in a similar way
to the current session - build a list of the possibilities then pick the
newest.
2009-11-04 22:44:01 +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 bbad75fb6c Sync OpenBSD patchset 483:
Change session and client activity and creation time members to have more
meaningful names.

Also, remove the code to try and update the session activity time for the
command client when a command message is received as is pointless because it
des not have a session.
2009-11-04 22:42:31 +00:00
Tiago Cunha a090b78e8d Sync OpenBSD patchset 482:
tv member of struct paste_buffer is updated but not otherwise used, so remove
it.
2009-11-04 22:39:20 +00:00
Tiago Cunha f3b4b60aa8 Sync OpenBSD patchset 480:
Double the escape timer (the time after a \033 is received before tmux gives up
waiting to see if it is part of a key sequence and passes it through) to 500
ms, the previous setting was too fast. Suggested by naddy.
2009-11-04 22:37:18 +00:00
Nicholas Marriott 91ad830c88 Switch window pane pipe redirect fd over to a bufferevent. 2009-11-04 22:02:38 +00:00