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@.
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.
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.
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.
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.
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.
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...
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.
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.
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.
Split the server code handling clients, jobs and windows off into separate
files from server.c (merging server-msg.c into the client file) and rather than
iterating over each set after poll(), allow a callback to be specified when the
fd is added and just walk once over the returned pollfds calling each callback
where needed.
More to come, getting this in so it is tested.
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@.
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.