Commit Graph

214 Commits

Author SHA1 Message Date
Tiago Cunha
88c3b9c989 Sync OpenBSD patchset 353:
New lock-client and lock-session commands to lock an individual client or all
clients attached to a session respectively.
2009-09-25 17:51:39 +00:00
Nicholas Marriott
8fa1858a2c New lock-client and lock-session commands to lock an individual client or all
clients attached to a session respectively.
2009-09-24 14:17:09 +00:00
Tiago Cunha
1310ea2729 Sync OpenBSD patchset 347:
Remove the internal tmux locking and instead detach each client and run the
command specified by a new option "lock-command" (by default "lock -np") in
each client.

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

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

This is the third protocol version change so again it is best to stop the tmux
server before upgrading.
2009-09-23 15:00:09 +00:00
Nicholas Marriott
b01dcd7971 Remove the internal tmux locking and instead detach each client and run the
command specified by a new option "lock-command" (by default "lock -np") in
each client.

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

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

This is the third protocol version change so again it is best to stop the tmux
server before upgrading.
2009-09-23 06:18:47 +00:00
Tiago Cunha
7335ef5792 Sync OpenBSD patchset 333:
Move some common and untidy code for window link/unlink into generic functions
instead of duplicating it in move/link window..
2009-09-20 22:15:32 +00:00
Tiago Cunha
3266fb5441 Sync OpenBSD patchset 332:
Regularise some fatal messages.
2009-09-20 22:11:27 +00:00
Nicholas Marriott
9b5f5ed8e8 Move some common and untidy code for window link/unlink into generic functions
instead of duplicating it in move/link window..
2009-09-20 17:27:18 +00:00
Nicholas Marriott
273f1b385c Regularise some fatal messages. 2009-09-20 14:58:12 +00:00
Tiago Cunha
69e7f4af19 Sync OpenBSD patchset 324:
Tidy some common code for destroying sessions into a new function.
2009-09-13 20:37:37 +00:00
Nicholas Marriott
8cb8a0da8d Tidy some common code for destroying sessions into a new function. 2009-09-12 13:01:19 +00:00
Tiago Cunha
bb2d57dcbf Sync OpenBSD patchset 316:
Only redraw all clients once when the backoff timer expires rather than every
second all the time.

Reported by Simon Nicolussi.
2009-09-05 19:03:41 +00:00
Nicholas Marriott
ffab22bb35 Only redraw all clients once when the backoff timer expires rather than every
second all the time.

Reported by Simon Nicolussi.
2009-09-05 17:42:16 +00:00
Tiago Cunha
c274551db6 - Make it compile on operating systems other than BSD due to OpenBSD patchset
308.
- While there, remove some duplicate code from the compat header file.
2009-09-03 20:54:39 +00:00
Tiago Cunha
f796336a12 Sync OpenBSD patchset 308:
When incorrect passwords are entered, behave similarly to login(1) and backoff
for a bit. Based on a diff from martynas@.
2009-09-03 20:44:38 +00:00
Nicholas Marriott
c5ac2579ba When incorrect passwords are entered, behave similarly to login(1) and backoff
for a bit. Based on a diff from martynas@.
2009-09-02 16:38:35 +00:00
Tiago Cunha
ce5c441f0f Sync OpenBSD patchset 304:
Use "Password:" with no space for password prompts and don't display a *s for
the password, like pretty much everything else. From martynas@ with minor
tweaks by me.
2009-09-02 00:55:49 +00:00
Nicholas Marriott
f8aa5821be Use "Password:" with no space for password prompts and don't display a *s for
the password, like pretty much everything else. From martynas@ with minor
tweaks by me.
2009-09-01 09:11:05 +00:00
Tiago Cunha
ed3535db8a Sync OpenBSD patchset 302:
Add a new display-panes command, with two options (display-panes-colour and
display-panes-time), which displays a visual indication of the number of each
pane.
2009-08-31 22:30:15 +00:00
Nicholas Marriott
04319964b9 Add a new display-panes command, with two options (display-panes-colour and
display-panes-time), which displays a visual indication of the number of each
pane.
2009-08-31 20:46:19 +00:00
Tiago Cunha
a9b6bfdddd Sync OpenBSD patchset 243:
Switch tmux to use imsg. This is the last major change to make the
client-server protocol more resilient and make the protocol versioning work
properly. In future, the only things requiring a protocol version bump will be
changes in the message structs, and (when both client and server have this
change) mixing different versions should nicely report an error message.

As a side effect this also makes the code tidier, fixes a problem with the way
errors reported during server startup were handled, and supports fd passing
(which will be used in future).

Looked over by eric@, thanks.

Please note that mixing a client with this change with an older server or vice
versa may cause tmux to crash or hang - tmux should be completely exited before
upgrading.
2009-08-14 21:04:04 +00:00
Nicholas Marriott
f0635717b3 Switch tmux to use imsg. This is the last major change to make the
client-server protocol more resilient and make the protocol versioning work
properly. In future, the only things requiring a protocol version bump will be
changes in the message structs, and (when both client and server have this
change) mixing different versions should nicely report an error message.

As a side effect this also makes the code tidier, fixes a problem with the way
errors reported during server startup were handled, and supports fd passing
(which will be used in future).

Looked over by eric@, thanks.

Please note that mixing a client with this change with an older server or vice
versa may cause tmux to crash or hang - tmux should be completely exited before
upgrading.
2009-08-11 17:18:35 +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
Tiago Cunha
5b56ea1816 Sync OpenBSD patchset 225:
If there is an error in the configuration file, don't just exit(1) as this can
cause the client to hang. Instead, send the error message, then mark the client
as bad and start a normal shutdown so the server exits once the error is
written.

This also allows some code duplicating daemon(3) to be trimmed and logging to
begin earlier.

Prompted by Theo noticing the behaviour on error wasn't documented.
2009-08-09 17:19:18 +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
Nicholas Marriott
e89e70e715 If there is an error in the configuration file, don't just exit(1) as this can
cause the client to hang. Instead, send the error message, then mark the client
as bad and start a normal shutdown so the server exits once the error is
written.

This also allows some code duplicating daemon(3) to be trimmed and logging to
begin earlier.

Prompted by Theo noticing the behaviour on error wasn't documented.
2009-08-07 15:39:10 +00:00
Tiago Cunha
6fbfcfc0d7 Sync OpenBSD patchset 196:
Rename struct hdrtype to msgtype which is a better name and can be used even
when struct hdr disappears.
2009-07-30 20:21:55 +00:00
Nicholas Marriott
c1d6d7ac6b Rename struct hdrtype to msgtype which is a better name and can be used even
when struct hdr disappears.
2009-07-29 14:17:26 +00:00
Tiago Cunha
d637cb33da Sync OpenBSD patchset 181:
Make all messages sent between the client and server fixed size.

This is the first of two changes to make the protocol more resilient and less
sensitive to other changes in the code, particularly with commands. The client
now packs argv into a buffer and sends it to the server for parsing, rather
than doing it itself and sending the parsed command data.

As a side-effect this also removes a lot of now-unused command marshalling
code.

Mixing a server without this change and a client with or vice versa will cause
tmux to hang or crash, please ensure that tmux is entirely killed before
upgrading.
2009-07-28 22:12:16 +00:00
Nicholas Marriott
34a82e7629 Make all messages sent between the client and server fixed size.
This is the first of two changes to make the protocol more resilient and less
sensitive to other changes in the code, particularly with commands. The client
now packs argv into a buffer and sends it to the server for parsing, rather
than doing it itself and sending the parsed command data.

As a side-effect this also removes a lot of now-unused command marshalling
code.

Mixing a server without this change and a client with or vice versa will cause
tmux to hang or crash, please ensure that tmux is entirely killed before
upgrading.
2009-07-26 12:58:44 +00:00
Tiago Cunha
54c6848d75 Sync OpenBSD patchset 148:
Display the number of failed password attempts (if any) when the server is
locked. From Tom Doherty.
2009-07-20 16:07:23 +00:00
Nicholas Marriott
54afcfbfb4 Display the number of failed password attempts (if any) when the server is
locked. From Tom Doherty.
2009-07-20 14:37:51 +00:00
Nicholas Marriott
19cb1fb592 Make it so using kill-pane to destroy the last pane in a window destroys the
window instead of being an error.
2009-07-18 11:07:14 +00:00
Nicholas Marriott
0ca6f667e3 Make it so using kill-pane to destroy the last pane in a window destroys the
window instead of being an error.
2009-07-17 20:37:03 +00:00
Nicholas Marriott
89543e999d A similar for fix for window_choose: don't rely on the callback always being
called to free data, have a separate free callback and call it from the mode
cleanup code.
2009-07-17 12:12:54 +00:00
Nicholas Marriott
fc17ce0150 Oops, it is always a good idea to get arguments the right way round. 2009-07-17 09:28:27 +00:00
Nicholas Marriott
441c118b63 Memory could be leaked if a second prompt or message appeared while another was
still present, so add a separate prompt free callback and make the _clear
function responsible for calling it if necessary (rather than the individual
2009-07-17 09:26:21 +00:00
Nicholas Marriott
d3b5c242cc Oops, it is always a good idea to get arguments the right way round. 2009-07-17 07:09:46 +00:00
Nicholas Marriott
65deba3a35 Memory could be leaked if a second prompt or message appeared while another was
still present, so add a separate prompt free callback and make the _clear
function responsible for calling it if necessary (rather than the individual
prompt callbacks). Also make both messages and prompts clear any existing when
a new is set.

In addition, the screen could be modified while the prompt is there, restore
the redraw-entire-screen behaviour on prompt clear; add a comment as a
reminder.
2009-07-17 06:13:27 +00:00
Nicholas Marriott
f44ae0535e Need time.h not sys/time.h for time(2). 2009-07-14 07:01:03 +00:00
Nicholas Marriott
4a9b01eb0d Need time.h not sys/time.h for time(2). 2009-07-14 06:59:06 +00:00
Nicholas Marriott
d7b4aa0ff3 Add a default-terminal option to set the starting value of $TERM in new
windows.
2009-07-12 17:07:58 +00:00
Nicholas Marriott
daa1faa905 Add a default-terminal option to set the starting value of $TERM in new
windows.

This is "screen" by default and must be either that or something closely
related. This does makes it easier to customise it if necessary.
2009-07-10 05:50:54 +00:00
Nicholas Marriott
99395856ff Bring spacing into line. 2009-07-08 18:07:09 +00:00
Nicholas Marriott
9cf68ac868 Whoops, that shouldn't have been there. 2009-07-08 18:05:33 +00:00
Nicholas Marriott
2ddcb51df3 Fix $Id$. 2009-07-08 18:03:03 +00:00
Nicholas Marriott
9e5a581307 When unlocking the server, don't try to clear the prompt on clients without a
prompt (such as the one issuing the unlock request).

This caused the server to die if the wrong password was entered when unlocking
from the command line with -U (nasty).
2009-07-08 17:54:36 +00:00
Nicholas Marriott
55f8219d3c When unlocking the server, don't try to clear the prompt on clients without a
prompt (such as the one issuing the unlock request).

This caused the server to die if the wrong password was entered when unlocking
from the command line with -U (nasty).
2009-07-01 19:15:12 +00:00
Nicholas Marriott
4c5c125173 When unlocking the server, don't try to clear the prompt on clients without a
prompt (such as the one issuing the unlock request).

This caused the server to die if the wrong password was entered when unlocking
from the command line with -U (nasty).
2009-06-30 13:40:30 +00:00
Nicholas Marriott
802e129fd7 Start of portability update: bitstring.h. 2009-06-25 17:02:59 +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
1675ddb4d1 Miscellaneous unused functions, including one which was basically a
duplicate. Found by lint.
2009-06-25 06:15:04 +00:00
Nicholas Marriott
35876eaab9 Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti
2009-06-01 22:58:49 +00:00
Nicholas Marriott
f63f5e6489 Clear status line on incorrect password. 2009-05-29 23:25:26 +00:00
Nicholas Marriott
8536ad0ce7 Reset activity time to avoid relock on -U. 2009-05-28 16:24:02 +00:00
Nicholas Marriott
5d1b6888dc Convert hidden flag to a full flags word for the status line and add a flag to
accept after only one key. Use this so don't need to press enter after y/n for
confirm-before.
2009-04-27 17:27:36 +00:00
Nicholas Marriott
84cde92c8f If redrawing the region would mean redrawing > half the pane, just schedule to
redraw the entire window. Also add a flag to skip updating the window any
further if it is scheduled to be redrawn. This has the effect of batching
multiple redraws together.
2009-04-02 20:30:23 +00:00
Nicholas Marriott
3f09bf99b8 char not char *... 2009-03-07 09:42:13 +00:00
Nicholas Marriott
65b9aeb337 Put socket path in $TMUX. 2009-03-04 17:24:07 +00:00
Nicholas Marriott
26edf4cce0 Don't segfault on lock when no sessions attached. 2009-02-27 16:01:31 +00:00
Nicholas Marriott
0450b4a5d4 Move status prompt/message init and teardown into status.c. 2009-02-13 18:57:55 +00:00
Nicholas Marriott
e3feb067a5 Server locking. set-password and lock-server commands, plus automatic locking. 2009-01-11 00:48:42 +00:00
Nicholas Marriott
fd05d07c2b Change server-info format. 2009-01-10 14:43:43 +00:00
Nicholas Marriott
9cddd796ff Prompt history. 2009-01-06 15:37:15 +00:00
Nicholas Marriott
33aa931541 Support OS X by moving to gettimeofday(2) and adding poll compat from OpenSSH. 2008-08-28 17:45:30 +00:00
Nicholas Marriott
e013970b0b Missing time.h. 2008-06-22 22:28:33 +00:00
Nicholas Marriott
17fde823a8 Freeze output when showing display line, fixes problems when no status line. 2008-06-20 06:36:01 +00:00
Nicholas Marriott
a1db273dc2 display-time option to set message display time. 2008-06-19 23:20:45 +00:00
Nicholas Marriott
7cebf4768b Hide cursor with flag. 2008-06-19 23:07:11 +00:00
Nicholas Marriott
74d8f0bf1d Command prompt for interactive commands. 2008-06-19 20:45:21 +00:00
Nicholas Marriott
c3b7a49cc1 Editable prompt. Not used for anything yet. More to come. 2008-06-19 19:40:35 +00:00
Nicholas Marriott
9ef5bdc7c0 Show status messages without blocking the server. 2008-06-19 18:27:55 +00:00
Nicholas Marriott
55d5b83408 Informational messages on window option changes. 2008-06-16 17:35:40 +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
958069575d Clear clients with flag too. 2008-06-07 07:13:08 +00:00
Nicholas Marriott
77224aaf8b Be more conservative about redrawing using flags. 2008-06-07 06:47:38 +00:00
Nicholas Marriott
9e6090a7a2 Per-session configuration options. 2008-06-03 21:42:37 +00:00
Nicholas Marriott
c7243b73cb Move -s and -c down a level so handling them is the responsibility of the command (with some helper functions), rather than the top-level. This changes the action command syntax so that -s and -c must be after the command rather than before. 2008-06-02 18:08:17 +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
b9034946ad Reset before calling window_draw otherwise it'll have the wrong idea of the current state (since it copies from screen). 2007-11-24 18:32:52 +00:00
Nicholas Marriott
112f4d9f60 Don't stop until after everything else done. 2007-11-24 18:09:59 +00:00
Nicholas Marriott
b2d78b67d8 Use screen_draw_* to write message, avoids leaving attribute changes around. 2007-11-24 17:58:45 +00:00
Nicholas Marriott
18d72e6928 Partial copy mode. Currently does the same as scroll mode but using a cursor. Also fix bug where resizing would leave crap lying around. 2007-11-22 18:09:43 +00:00
Nicholas Marriott
df7be0ddab Split SCREEN_BACKGROUND flag into BACKGROUND/NOCURSOR in preparation for copy mode. 2007-11-22 09:11:20 +00:00
Nicholas Marriott
ce90f1bddb The CLIENT_HOLD hack can go bye-bye. 2007-11-21 20:04:37 +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
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
c0572ea992 Fix a format string bug and sprinkle some printflikes. 2007-11-20 18:11:37 +00:00
Nicholas Marriott
941eab33e9 %u -> %d for indexes. Some lint fixes. 2007-10-30 10:59:43 +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
688a487570 Lift last MAXNAMELEN limit on -s argument. 2007-10-23 10:48:23 +00:00
Nicholas Marriott
de24fbb35c Add a bell-action option. 2007-10-19 10:21:36 +00:00
Nicholas Marriott
ad4a7423c0 Mark windows in yellow on status line when bell. 2007-10-12 11:24:15 +00:00
Nicholas Marriott
f2b18ac417 Don't resize if sx AND sy haven't changed. Also tweak some logging, and reset attrs after clear. 2007-10-04 19:22:26 +00:00
Nicholas Marriott
1f9a8e70d9 Incomplete resize support. 2007-10-04 19:03:52 +00:00
Nicholas Marriott
19c1e1a800 Rename window. 2007-10-04 10:39:07 +00:00
Nicholas Marriott
815815989a Next/last/previous window, some other tweaks. 2007-10-04 00:02:10 +00:00
Nicholas Marriott
7ba01f6843 New window command. 2007-10-03 23:32:26 +00:00
Nicholas Marriott
df716ecc8f Rewrite command handling to be more generic. Not finished! 2007-10-03 21:31:07 +00:00
Nicholas Marriott
fe06744d66 String/number arguments.. 2007-10-03 12:34:16 +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
a6d3594d39 Redraw client status lines on rename. 2007-10-02 17:45:05 +00:00
Nicholas Marriott
bfccbc67d1 Simple status line. 2007-10-01 14:53:29 +00:00
Nicholas Marriott
872696f781 Pass attributes around as flags rather than as a list of escape codes. 2007-10-01 14:18:42 +00:00
Nicholas Marriott
653ee721df Write error messages for rename. Also tweak some error outputs, and fix -i. 2007-09-29 13:22:15 +00:00
Nicholas Marriott
2ec60c9d66 Pass bell through from any window. 2007-09-29 09:53:25 +00:00
Nicholas Marriott
4d6cfe5f22 Terminate buffers properly. 2007-09-28 21:08:30 +00:00
Nicholas Marriott
58affec94c Split list into ls/lsw. 2007-09-27 10:09:37 +00:00
Nicholas Marriott
22990a6595 New session selection rules:
- find by name if given
	- otherwise try current index from $TMUX
	- otherwise if only one session, use it
	- otherwise error
2007-09-27 09:52:03 +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
302a35da85 Server function naming, still not happy with server stuff though. 2007-09-26 18:09:23 +00:00
Nicholas Marriott
671694ac30 Cleanup part 1: split up server.c. 2007-09-26 10:35:24 +00:00