Commit Graph

555 Commits (5d8dbcdf3d76d0e69b8f2d21eff48f819dcec199)

Author SHA1 Message Date
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
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 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 36e537bcef PatchSet 786
Date: 2010/11/14 08:58:25
Author: nicm
Branch: HEAD
Tag: (none)
Log:
Don't allow last and active window to become the same - a very bad move
when the active window is closed and freed. Reported by sthen@.

Members:
        window.c:1.58->1.59
2010-12-06 21:53:50 +00:00
Nicholas Marriott 503edae26f Don't allow last and active window to become the same - a very bad move
when the active window is closed and freed. Reported by sthen@.
2010-11-14 08:58:25 +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 8703e9f2f9 Sync OpenBSD patchset 779:
When removing a pane, don't change the active pane unless the active
pane is actually the one being removed.
2010-10-24 01:32:35 +00:00
Tiago Cunha d4b58c71a2 Sync OpenBSD patchset 775:
Trying to set FD_CLOEXEC on every fd is a lost cause, just use
closefrom() before exec.
2010-10-24 00:45:57 +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 a3efd2ab5a When removing a pane, don't change the active pane unless the active
pane is actually the one being removed.
2010-10-23 12:51:51 +00:00
Nicholas Marriott f56b4ec2ff Trying to set FD_CLOEXEC on every fd is a lost cause, just use
closefrom() before exec.
2010-10-16 08:31:55 +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 01052ca38e Sync OpenBSD patchset 754:
When destroying a pane, reset any mode (which reenables pane
bufferevent) before freeing the bufferevent.
2010-08-29 14:46:13 +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 f69ce39a6c When destroying a pane, reset any mode (which reenables pane
bufferevent) before freeing the bufferevent.
2010-08-25 19:19:43 +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 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
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
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
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 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 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 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 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 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
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 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 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 cc094fdfe6 Sync OpenBSD patchset 581:
Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...
2009-12-04 22:14:47 +00:00
Nicholas Marriott 15a64b805e Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...
2009-12-03 22:50:09 +00:00
Tiago Cunha 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
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
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
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
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 8e47966225 Destroy panes immediately rather than checking them all every loop. 2009-11-13 17:33:07 +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 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 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 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 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
Nicholas Marriott 91ad830c88 Switch window pane pipe redirect fd over to a bufferevent. 2009-11-04 22:02:38 +00:00
Nicholas Marriott abf3a5d50e 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-04 20:50:11 +00:00
Tiago Cunha 9ad2347258 Sync OpenBSD patchset 437:
Only redraw the pane when changing mode, not the entire window.
2009-10-23 17:41:20 +00:00
Tiago Cunha 9463492ac1 Sync OpenBSD patchset 417:
Stop updating the screen when not in output mode, stops copy mode getting
confused.
2009-10-23 17:09:21 +00:00
Nicholas Marriott fd35b6f836 Only redraw the pane when changing mode, not the entire window. 2009-10-22 12:30:00 +00:00
Nicholas Marriott 2afe395ff2 Stop updating the screen when not in output mode, stops copy mode getting
confused.
2009-10-19 13:18:13 +00:00
Tiago Cunha 6091b051fb Sync OpenBSD patchset 387:
Add a pipe-pane command to allow a pane to be piped to a shell command, for
example:

        pipe-pane 'cat >~/out'

No arguments stops outputing and closes the pipe; the -o flag toggles a pipe
and on and off (useful for key bindings).

Suggested by espie@.
2009-10-12 00:35:08 +00:00
Tiago Cunha b26ea8462e Sync OpenBSD patchset 381:
Clean up by introducing a wrapper struct for mouse clicks rather than passing
three u_chars around.

As a side-effect this fixes incorrectly rejecting high cursor positions
(because it was comparing them as signed char), reported by Tom Doherty.
2009-10-12 00:18:19 +00:00
Tiago Cunha cf9804f2a0 Sync OpenBSD patchset 376:
Accept key and mouse input for keys in zombified windows if they are in a mode..
2009-10-12 00:04:56 +00:00
Tiago Cunha ea1721bcb0 Sync OpenBSD patchset 373:
New option, mouse-select-pane. If on, the mouse may be used to select the
current pane.

Suggested by sthen@ and also by someone else ages ago who I have forgotten.
2009-10-11 23:46:02 +00:00
Tiago Cunha 6a1ebb11df Sync OpenBSD patchset 371:
Add "grouped sessions" which have independent name, options, current window and
so on but where the linked windows are synchronized (ie creating, killing
windows and so on are mirrored between the sessions). A grouped session may be
created by passing -t to new-session.

Had this around for a while, tested by a couple of people.
2009-10-11 23:38:16 +00:00
Nicholas Marriott 64b5f39656 Add a pipe-pane command to allow a pane to be piped to a shell command, for
example:

	pipe-pane 'cat >~/out'

No arguments stops outputing and closes the pipe; the -o flag toggles a pipe
and on and off (useful for key bindings).

Suggested by espie@.
2009-10-11 10:04:27 +00:00
Nicholas Marriott 4bc0f6e7e9 Clean up by introducing a wrapper struct for mouse clicks rather than passing
three u_chars around.

As a side-effect this fixes incorrectly rejecting high cursor positions
(because it was comparing them as signed char), reported by Tom Doherty.
2009-10-11 07:01:10 +00:00
Nicholas Marriott 2988c594cc Accept key and mouse input for keys in zombified windows if they are in a mode.. 2009-10-10 15:29:34 +00:00
Nicholas Marriott 4658c063d5 New option, mouse-select-pane. If on, the mouse may be used to select the
current pane.

Suggested by sthen@ and also by someone else ages ago who I have forgotten.
2009-10-10 14:51:16 +00:00
Nicholas Marriott 9dd72b9583 Add "grouped sessions" which have independent name, options, current window and
so on but where the linked windows are synchronized (ie creating, killing
windows and so on are mirrored between the sessions). A grouped session may be
created by passing -t to new-session.

Had this around for a while, tested by a couple of people.
2009-10-10 10:02:48 +00:00
Tiago Cunha 9ac062acef Sync OpenBSD patchset 367:
Add a simple synchronize-panes window option: when set, all input to any pane
that is part of the window is also sent to all other panes in the same
window. Suggested by several, most recently Tomasz Pajor.
2009-10-09 13:07:04 +00:00
Nicholas Marriott 3af09ac946 Add a simple synchronize-panes window option: when set, all input to any pane
that is part of the window is also sent to all other panes in the same
window. Suggested by several, most recently Tomasz Pajor.
2009-10-09 07:27:00 +00:00
Nicholas Marriott d73516c0a9 Use __sun not __sun__ as Sun's CC doesn't define the latter. 2009-09-23 16:09:12 +00:00
Tiago Cunha 3266fb5441 Sync OpenBSD patchset 332:
Regularise some fatal messages.
2009-09-20 22:11:27 +00:00
Nicholas Marriott 273f1b385c Regularise some fatal messages. 2009-09-20 14:58:12 +00:00
Nicholas Marriott 15b643fc11 Sync from OpenBSD:
==
Rather than constructing an entire termios struct from ttydefaults.h, just let
forkpty do it and then alter the bits that should be changed after fork. A
little neater and more portable.
==

This should fix problems caused by glibc's broken ttydefaults.h file.
2009-09-16 12:36:28 +00:00
Nicholas Marriott 5c60162e3c Rather than constructing an entire termios struct from ttydefaults.h, just let
forkpty do it and then alter the bits that should be changed after fork. A
little neater and more portable.
2009-09-16 12:35:04 +00:00
Tiago Cunha 5838ee1263 Sync OpenBSD patchset 306:
If forking a login shell or if SHELL is otherwise not useful, set it to the
default shell. Based on a diff from martynas@.
2009-09-02 01:08:32 +00:00
Tiago Cunha a3a150faf2 Sync OpenBSD patchset 305:
When using tmux as a login shell, there is currently no way to specify a shell
to be used as a login shell inside tmux, so add a default-shell session option.
This sets the shell invoked as a login shell when the default-command option is
empty.

The default option value is whichever of $SHELL, getpwuid(getuid())'s pw_shell
or /bin/sh is valid first.

Based on a diff from martynas@, changed by me to be a session option rather
than a window option.
2009-09-02 01:02:44 +00:00
Nicholas Marriott c089e19020 If forking a login shell or if SHELL is otherwise not useful, set it to the
default shell. Based on a diff from martynas@.
2009-09-01 14:40:33 +00:00
Nicholas Marriott 7d5e494716 When using tmux as a login shell, there is currently no way to specify a shell
to be used as a login shell inside tmux, so add a default-shell session option.
This sets the shell invoked as a login shell when the default-command option is
empty.

The default option value is whichever of $SHELL, getpwuid(getuid())'s pw_shell
or /bin/sh is valid first.

Based on a diff from martynas@, changed by me to be a session option rather
than a window option.
2009-09-01 13:09:49 +00:00
Tiago Cunha e61ee94e26 Sync OpenBSD patchset 257:
Add a base-index session option to specify the first index checked when looking
for an index for a new window.
2009-08-16 19:16:27 +00:00
Tiago Cunha f415d43c3b Sync OpenBSD patchset 254:
When creating a new session from the command-line where there is an external
terminal, copy the termios(4) special characters and use them for new windows
created in the new session. Suggested by Theo.
2009-08-16 18:59:12 +00:00
Tiago Cunha 06b3f49c49 Sync OpenBSD patchset 249:
When started as the shell, __progname contains a leading -, so hardcode "tmux"
for socket path and log files, and strip it when working out the shell.
2009-08-14 21:28:00 +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
Nicholas Marriott 3ad4de6c8c Add a base-index session option to specify the first index checked when looking
for an index for a new window.
2009-08-13 20:11:58 +00:00
Nicholas Marriott 52793e7a3f When creating a new session from the command-line where there is an external
terminal, copy the termios(4) special characters and use them for new windows
created in the new session. Suggested by Theo.
2009-08-13 19:03:59 +00:00
Nicholas Marriott 9a52ef099a When started as the shell, __progname contains a leading -, so hardcode "tmux"
for socket path and log files, and strip it when working out the shell.
2009-08-12 09:14:25 +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
Tiago Cunha 29b1b2fb5e Sync OpenBSD patchset 231:
Infrastructure and commands to manage the environment for processes started
within tmux.

There is a global environment, copied from the external environment when the
server is started and each session has an (initially empty) session
environment which overrides it.

New commands set-environment and show-environment manipulate or display the
environments.

A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.
2009-08-09 17:48:55 +00:00
Nicholas Marriott 6491274f60 Infrastructure and commands to manage the environment for processes started
within tmux.

There is a global environment, copied from the external environment when the
server is started and each sesssion has an (initially empty) session
environment which overrides it.

New commands set-environment and show-environment manipulate or display the
environments.

A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.
2009-08-08 21:52:43 +00:00
Tiago Cunha d9dcc5ed44 Sync OpenBSD patchset 191:
If select-layout is not given an argument, reapply the last layout used in the
window, if any.
2009-07-28 23:04:29 +00:00
Nicholas Marriott 2da4864483 If select-layout is not given an argument, repply the last layout used in the
window, if any.
2009-07-28 06:48:44 +00:00
Tiago Cunha 6708ad19c5 Sync OpenBSD patchset 165:
window_add_pane cannot fail, so remove the unused cause argument and don't
bother to check for a NULL return.
2009-07-23 13:10:38 +00:00
Nicholas Marriott 5ee84436c8 window_add_pane cannot fail, so remove the unused cause argument and don't
bother to check for a NULL return.
2009-07-22 21:34:36 +00:00
Tiago Cunha d29b57f597 Sync OpenBSD patchset 155:
Make some functions which return unused values void (mostly found by lint) and
tweak a redundant expression in window_pane_set_mode.
2009-07-22 17:46:53 +00:00
Nicholas Marriott 94e2339842 OpenSolaris ioctl(TIOCSWINSZ) appears to be broken and can return EINVAL here
despite sx, sy and fd being fine (an fcntl on the fd succeeds). No problems on
other platforms so ignore the error under #ifdef __sun__.
2009-07-22 12:42:57 +00:00
Nicholas Marriott 76a9d98562 Make some functions which return unused values void (mostly found by lint) and
tweak a redundant expression in window_pane_set_mode.
2009-07-21 19:54:22 +00:00
Tiago Cunha 545893df73 Sync OpenBSD patchset 142:
Each window now has a tree of layout cells associated with it. In this tree,
each node is either a horizontal or vertical cell containing a list of other
cells running from left-to-right or top-to-bottom, or a leaf cell which is
associated with a pane.

The major functional changes are:

- panes may now be split arbitrarily both horizontally (splitw -h, C-b %) and
  vertically (splitw -v, C-b ");
- panes may be resized both horizontally and vertically (resizep -L/-R/-U/-D,
  bound to C-b left/right/up/down and C-b M-left/right/up/down);
- layouts are now applied and then may be modified by resizing or splitting
  panes, rather than being fixed and reapplied when the window is resized or
  panes are added;
- manual-vertical layout is no longer necessary, and active-only layout is gone
  (but may return in future);
- the main-pane layouts now reduce the size of the main pane to fit all panes
  if possible.

Thanks to all who tested.
2009-07-20 15:42:05 +00:00
Nicholas Marriott 6036bdd06c Improved layout code.
Each window now has a tree of layout cells associated with it. In this tree,
each node is either a horizontal or vertical cell containing a list of other
cells running from left-to-right or top-to-bottom, or a leaf cell which is
associated with a pane.

The major functional changes are:

- panes may now be split arbitrarily both horizontally (splitw -h, C-b %) and
  vertically (splitw -v, C-b ");
- panes may be resized both horizontally and vertically (resizep -L/-R/-U/-D,
  bound to C-b left/right/up/down and C-b M-left/right/up/down);
- layouts are now applied and then may be modified by resizing or splitting
  panes, rather than being fixed and reapplied when the window is resized or
  panes are added;
- manual-vertical layout is no longer necessary, and active-only layout is gone
  (but may return in future);
- the main-pane layouts now reduce the size of the main pane to fit all panes
  if possible.

Thanks to all who tested.
2009-07-19 13:21:40 +00:00
Nicholas Marriott 6f5150a943 - New command display-message (alias display) to display a message in the
status line (bound to "i" and displays the current window and time by
  default). The same substitutions are applied as for status-left/right.
- Add support for including the window index (#I), pane index (#P) and window
  name (#W) in the message, and status-left or status-right.
- Bump protocol version.

From Tiago Cunha, thanks!
2009-07-17 18:45:08 +00:00
Tiago Cunha ae7dda10ce - New command display-message (alias display) to display a message in the
status line (bound to "i" by default).
- Add support for including the window index, pane index, and window name
  in status-left, or status-right.
- Bump protocol version.
2009-07-17 18:32:54 +00:00
Nicholas Marriott 8bfbc8c61d The man page says that kill-window removes the window entirely, unlinking it
from any sessions. In fact the implementation only affected the current
session, making it the same as unlink-window but destroying the window if it
was linked into only one session (unlinkw gives an error). Change the behaviour
to match what it documented and was originally intended.
2009-07-15 17:45:09 +00:00
Nicholas Marriott ad1945c278 Don't accept input to a window if it not visible. 2009-07-15 17:43:21 +00:00
Nicholas Marriott 1e574bb70c Get rid of the PANE_HIDDEN flag in favour of a function, and moving the
decision for whether or not a pane should be drawn out of the layout code and
into the redraw code.

This is needed for the new layout design, getting it in now to make that easier
to work on.
2009-07-15 17:42:44 +00:00
Nicholas Marriott 9601b72e4c The man page says that kill-window removes the window entirely, unlinking it
from any sessions. In fact the implementation only affected the current
session, making it the same as unlink-window but destroying the window if it
was linked into only one session (unlinkw gives an error). Change the behaviour
to match what it documented and was originally intended.
2009-07-15 08:00:49 +00:00
Nicholas Marriott e76caa0017 Don't accept input to a window if it not visible. 2009-07-14 16:52:50 +00:00
Nicholas Marriott fe20c0d89e Get rid of the PANE_HIDDEN flag in favour of a function, and moving the
decision for whether or not a pane should be drawn out of the layout code and
into the redraw code.

This is needed for the new layout design, getting it in now to make that easier
to work on.
2009-07-14 07:23:36 +00:00
Nicholas Marriott e63567d51c Support "alternate screen" mode (terminfo smcup/rmcup) typically used by full
screen interactive programs to preserve the screen contents. When activated, it
saves a copy of the visible grid and disables scrolling into and resizing out
of the history; when deactivated the visible data is restored and the history
reenabled.
2009-07-14 06:40:33 +00:00
Nicholas Marriott 359285928b Support "alternate screen" mode (terminfo smcup/rmcup) typically used by full
screen interactive programs to preserve the screen contents. When activated, it
saves a copy of the visible grid and disables scrolling into and resizing out
of the history; when deactivated the visible data is restored and the history
reenabled.
2009-07-13 10:43:52 +00:00
Nicholas Marriott 2ddcb51df3 Fix $Id$. 2009-07-08 18:03:03 +00:00
Nicholas Marriott 86504af149 Rename the global options variables to be shorter and to make session options
clear. No functional change, getting this out of the way to make later options
changes easier.
2009-07-08 18:01:31 +00:00
Nicholas Marriott 084d07f4eb Just appending -l to $SHELL to create a login shell is wrong: -l is not POSIX,
and some people may use shells which do not support it. Instead, make an empty
default-command option mean a login shell, and fork it with a - in argv[0]
which is the method used by login(1).

Also fix the automatic-rename code to handle this correctly and to strip a
leading - if present.
2009-07-08 05:26:45 +00:00
Nicholas Marriott 923ccfa2e8 Rename the global options variables to be shorter and to make session options
clear. No functional change, getting this out of the way to make later options
changes easier.
2009-07-07 19:49:19 +00:00
Nicholas Marriott 08c7249636 Change default_window_name to use window_default_command if the actual cmd is
empty. From Josh Elsasser.
2009-07-02 18:17:46 +00:00
Nicholas Marriott 22d1b9412e Using -l to specify a login shell is non-POSIX and causes problems with shells
that do not support it. Instead, set an empty default-command to invoke $SHELL
with - prefixed to argv[0], and make this the default setting.
2009-07-01 19:42:55 +00:00
Nicholas Marriott a9e3d5c56a More diff-to-OpenBSD reduction. Move a lot of compat stuff into compat.h. 2009-06-25 16:47:00 +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 f7a9eb46fc Change find-window and monitor-content to use fnmatch(3). For convenience and
compatibility, *s are implicitly added at the start and end of the pattern.
2009-06-25 16:04:24 +00:00
Nicholas Marriott 853ad68162 Add a dedicated function to convert a line into a string and use it to simplify the search window function. 2009-06-25 16:02:37 +00:00
Nicholas Marriott 7eff7f7629 If a pane is "zombified" (remain-on-exit flag), don't continue to queue key and
mouse input for it (otherwise they are processed after respawn).
2009-06-25 16:00:25 +00:00
Nicholas Marriott fbcee9f114 strdup the input to putenv to avoid in one case passing a string that is later
freed and in the other const strings.
2009-06-25 15:58:58 +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 7e796dea03 Change find-window and monitor-content to use fnmatch(3). For convenience and
compatibility, *s are implicitly added at the start and end of the pattern.

Also display the line number and the entire line in the results, and lose the
nasty section_string function and the now empty util.c file.

Initially from Tiago Cunha.
2009-06-24 22:49:56 +00:00
Nicholas Marriott 096cbf2ea5 Add a dedicated function to convert a line into a string and use it to simplify the search window function. 2009-06-24 22:04:18 +00:00
Nicholas Marriott 69f3c24647 If a pane is "zombified" (remain-on-exit flag), don't continue to queue key and
mouse input for it (otherwise they are processed after respawn).
2009-06-23 20:17:30 +00:00
Nicholas Marriott a3c32841e6 strdup the input to putenv to avoid in one case passing a string that is later
freed and in the other const strings.

looks sane to millert, ok ray
2009-06-05 07:18:37 +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
Tiago Cunha 80af85a102 - New window option monitor-content to search for a string in a window, and
highlight the status line if it matches.
- To make this possible, the function cmd_find_window_search from
  cmd-find-window.c had to be moved to window.c and renamed window_pane_search.
- While there use three new functions in server.c to check for bell, activity,
  and content, to avoid too much nesting.
2009-05-19 13:32:55 +00:00
Nicholas Marriott ab4e5e8574 Clean up manual layout code:
- change the one layout function into two _refresh and _resize
- create layout-manual.c for manual layout code
- move the fit panes/update panes code from window.c to the new file as it is only used by manual layout now
- move the resize pane code into layout-manual.c as well
- get rid of the direct calls to fit/update and make them go through layout
- rename a couple of variables

This is mainly as a first step before reworking the manual layout code to see if anything breaks.
2009-05-18 21:01:38 +00:00
Nicholas Marriott 92de1ad6c8 putenv can be char *. 2009-05-15 12:58:56 +00:00
Nicholas Marriott 4b64bd7b01 It is HAVE_PTY_H, also add a cast to shut gcc up. 2009-05-14 07:58:38 +00:00
Nicholas Marriott c8cf438d44 Rename all feature flags to HAVE_* and move out of makefiles into a configure
script which must be run before building.

Still two makefiles but they are a hell of a lot simpler.

HAVE_* also will make it easier to move to $buildsystem if necessary later.
2009-05-13 23:27:00 +00:00
Nicholas Marriott 143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott 673290d019 Adjust mouse for x offset. 2009-04-01 18:46:03 +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 56f80a5b09 break-pane command to split a pane off into a new window; bound to ! by default. 2009-03-07 09:29:54 +00:00
Nicholas Marriott 792b4db4a7 Doh. Set a message when pane is too small rather than dying... 2009-03-01 22:05:35 +00:00
Nicholas Marriott cce03e138b Looking up argv[0] is expensive, so just use p_comm for the window name which is good enough. Also increase name update time to 500 ms. 2009-02-13 00:43:04 +00:00
Nicholas Marriott 3a7f3bd292 Reset name when clearing mode. 2009-02-12 17:31:23 +00:00
Nicholas Marriott c9cfc9a9f3 Don't try to change the window name unless the pid of the process chosen has
changed. Reduces CPU use.

osdep-* stuff is a bit horrible now but there we go :-/.
2009-02-09 18:08:01 +00:00
Nicholas Marriott 62d2ab3e68 Continue process if suspended. 2009-02-08 16:11:26 +00:00
Nicholas Marriott 4428987e95 * Better support for at least the most common variant of mouse input: parse it and adjust for different panes. Also support mouse in window/session choice mode.
* Bring back the fancy window titles with session/window names: it is easy to work around problems with elinks (see FAQ).
2009-01-28 19:52:21 +00:00
Nicholas Marriott 9cde0c2477 Be more clever about picking window name. 2009-01-26 22:57:20 +00:00
Nicholas Marriott 4d9af27b0b Better error messages for fork. 2009-01-23 16:59:14 +00:00
Nicholas Marriott 19987feaaa Bring back -p and -l to splitw to specify height as % or nlines. 2009-01-21 19:38:51 +00:00
Nicholas Marriott 2d15f59859 Try to change the window title to match the command running it in. This is done
by reading argv[0] from the process group leader of the group that owns the tty
(tcgetpgrp()). This can't be done portably so some OS-dependent code is
introduced (ugh); OpenBSD, FreeBSD and Linux are supported at the moment.

A new window flag, automatic-rename, is available: if this is set to off, the
window name is not changed. Specifying a name with the new-window, new-session
or rename-window commands will automatically set this flag to off for the
window in question. To disable it entirely set the option to off globally (setw
-g automatic-rename off).
2009-01-20 19:35:03 +00:00
Nicholas Marriott d1a5fde3d0 -a flags to next/previous window. 2009-01-18 18:31:45 +00:00
Nicholas Marriott b4ac8c1342 Multiple window splitting. 2009-01-14 19:29:32 +00:00
Nicholas Marriott f85559144f kill-pane command. 2009-01-13 06:50:10 +00:00
Nicholas Marriott 7cd3cf0ead Make the window pane code handle panes of different sizes, and add a -l and -p arguments to split-window to specify the new window size in lines or as a percentage. 2009-01-12 18:22:47 +00:00
Nicholas Marriott 162bacdcd9 Window splitting. Two vertical panes fixed 50% each. This is a huge diff, still a couple of bugs (notably heap corruption somewhere causing segfault on exit). 2009-01-11 23:31:46 +00:00
Nicholas Marriott 4d71164826 Pick up cwd from environment,. 2009-01-10 19:37:35 +00:00
Nicholas Marriott fd05d07c2b Change server-info format. 2009-01-10 14:43:43 +00:00
Nicholas Marriott 7a82e86827 Make window options work the same was as session options, add mode-fg/mode-bg options, force -g for global on set/show/setw/showw/ 2008-12-08 16:19:51 +00:00
Nicholas Marriott 46f5e42145 Keep stack of previous windows.
Check for op (orig_pair) for default colours.
2008-11-16 10:10:26 +00:00
Nicholas Marriott 62457bce0b Trim. 2008-09-26 06:45:28 +00:00
Nicholas Marriott f07cedf048 Rename some functions. 2008-09-10 19:15:06 +00:00
Nicholas Marriott e5cf8594e8 long for pid. 2008-07-01 20:35:16 +00:00
Nicholas Marriott 80a594cae3 Document zombie window stuff. 2008-06-30 18:27:14 +00:00
Nicholas Marriott d90d646ca8 Zombie windows, requested by Will Maier. 2008-06-29 07:04:31 +00:00
Nicholas Marriott 4e4f71febb Swap in new paste buffer code and add a couple more commands. 2008-06-20 17:31:48 +00:00
Nicholas Marriott 99df48d70f Trimify. 2008-06-18 22:21:51 +00:00
Nicholas Marriott be53d7f298 More Sun OS crap. 2008-06-18 20:11:25 +00:00
Nicholas Marriott 19b7946a85 Start of Solaris port. 2008-06-18 19:34:50 +00:00
Nicholas Marriott 0f403474aa New window options: force-width and force-height. This will force a window to
an arbitrary width and height (0 for the default unlimited). This is neat for
  emacs which doesn't have a sensible way to force hard wrapping at 80
  columns. Also, don't try to be clever and use clr_eol when redrawing the
  whole screen, it causes trouble since the redraw functions are used to draw
  the blank areas too.
2008-06-14 16:47:20 +00:00
Nicholas Marriott b044d0951f ifdef RB_PREV since 4.3 misses it too. 2008-06-04 20:17:25 +00:00
Nicholas Marriott 0f95671fe3 Disable/enable window activity monitoring with set-window-option command. 2008-06-04 17:54:27 +00:00
Nicholas Marriott 9e6090a7a2 Per-session configuration options. 2008-06-03 21:42:37 +00:00
Nicholas Marriott 85d520c41e tree.h has RB_PREV now, yay! 2008-06-03 18:38:51 +00:00
Nicholas Marriott 5569ff9723 Don't hang when window closes early; also add lots more debugging. 2008-05-31 20:04:15 +00:00
Nicholas Marriott ccfeb316a6 Don't attempt to reset tty if it is dead. 2008-01-02 19:22:21 +00:00
Nicholas Marriott 7dc18f68e3 set/reset mode window functions. 2007-12-06 10:04:43 +00:00
Nicholas Marriott 103748d6ad Major reorganisation of screen handling. 2007-12-06 09:46:23 +00:00
Nicholas Marriott 76c8a590db Big internal reorganisation to move tty control into parent. 2007-11-27 19:23:34 +00:00
Nicholas Marriott d0984b890b Sort out cursors with a new flag - BACKGROUND - for window modes. Free text on more exit. 2007-11-21 19:53:57 +00:00
Nicholas Marriott 24c39950ff Redo screen.c functions to make them readable and more flexible. Make scroll mode only redraw waht it needs. 2007-11-21 18:24:49 +00:00
Nicholas Marriott d5edaf988e Horizontal history/scrolling. 2007-11-21 15:35:53 +00:00
Nicholas Marriott 9a6e47cfa8 Initial history support. 2007-11-21 13:11:41 +00:00
Nicholas Marriott ceab127fac Mass screen.c rename/tidy. Add a actual size (ysize) as distinct from display size (now dx,dy). Move functions which work on the displayed area into screen-display.c and tidy. Use macros consistently when accessing screen data (may want to move everything about again later!). This the first step on the road to scrollback. 2007-11-20 21:42:29 +00:00
Nicholas Marriott 35591ecd4e Try write even if read gets signal, some other tweaks. 2007-11-07 19:41:17 +00:00
Nicholas Marriott 08d9f46aae Make it build/run on Linux. 2007-10-31 14:26:26 +00:00
Nicholas Marriott 4ba3cf60be Reorg window data structures. Add an intermediate data type (struct winlink) to hold index and make sessions hold a RB tree of them rather than a fixed array. 2007-10-26 12:29:07 +00:00
Nicholas Marriott ebeb14211d Handle DSR for resize(1). 2007-10-24 15:29:29 +00:00
Nicholas Marriott 810a8846b7 A couple of close-on-exec flags. 2007-10-24 11:30:02 +00:00
Nicholas Marriott ab02144e3d Don't need ttydefchars here. 2007-10-23 11:25:32 +00:00
Nicholas Marriott cf77c80b93 FreeBSD's util.h is libutil.h. 2007-10-19 20:47:09 +00:00
Nicholas Marriott 4add09eab7 Wrong size. 2007-10-04 20:33:16 +00:00
Nicholas Marriott 7ba01f6843 New window command. 2007-10-03 23:32:26 +00:00
Nicholas Marriott a5a17b40ee Skip exec on cmds. Also use xmemstrdup where appropriate. 2007-10-03 13:07:42 +00:00
Nicholas Marriott 9bb907f2a7 Move command handling into the server and tidy up some bits. 2007-10-03 10:18:32 +00:00
Nicholas Marriott 9d563c340b Destroy screens properly. 2007-10-01 14:15:48 +00:00
Nicholas Marriott 1e316cfc7c Lose intermediate handling (unused). Change argument parsing to work properly over multiple buffers by saving a copy of the argument (we can't just save off/len since the buffer may vanish at any point). 2007-09-29 14:25:49 +00:00
Nicholas Marriott 0bbe838b25 Window flags, currently only bell. 2007-09-29 09:15:49 +00:00
Nicholas Marriott aafee17de6 New input parser via state machine. 2007-09-28 22:47:22 +00:00
Nicholas Marriott 3fa8f16364 Adjust $TMUX environ var to include session index, and don't compact session list on release. Also fix some argument types. 2007-09-27 09:15:58 +00:00
Nicholas Marriott 5ea2ac36e4 Stop crashing when exiting windows. 2007-09-21 20:45:06 +00:00
Nicholas Marriott 33f5f84f99 Whoops. Other way round. 2007-09-21 18:20:44 +00:00
Nicholas Marriott 1702a781bb Be more careful about destroying windows. 2007-09-21 18:11:25 +00:00
Nicholas Marriott 2cd99f0ebb Reset ignored signals after forkpty. 2007-09-20 09:43:33 +00:00
Nicholas Marriott b1782e1b3d Truncate array if last window is closed. 2007-09-19 16:00:55 +00:00
Nicholas Marriott e3440e017d Don't renumber on close. 2007-09-19 15:16:23 +00:00
Nicholas Marriott 5cb483680f Use after free. 2007-08-27 11:41:00 +00:00
Nicholas Marriott b9de906ad9 We use screen now, not ansi. 2007-08-27 10:08:44 +00:00
Nicholas Marriott 4b62b1d16c Sync with fdm. 2007-07-25 23:13:18 +00:00
Nicholas Marriott a41ece5ff0 Initial import to CVS. Basic functions are working, albeit with a couple of showstopper memory bugs and many missing features. Detaching, reattaching, creating new sessions, listing sessions work acceptably for using with shells. Simple curses programs (top, systat, tetris) and more complicated ones (mutt, emacs) that don't require scrolling regions (ESC[r) mostly work fine (including mutt, emacs). No status bar yet and no key remapping or other customisation. 2007-07-09 19:04:12 +00:00