Commit Graph

38 Commits (828f12b74876e9cc51fc60ab59f397d697f7041c)

Author SHA1 Message Date
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
Nicholas Marriott 77f9c49829 dup() the stdin fd so it isn't closed twice (once for stdin, once for tty). 2010-07-28 22:15:15 +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
Nicholas Marriott 2a0f3f0d79 Send the \n to stdout with the message, not stderr... doh. 2010-07-19 18:27:38 +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
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 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 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
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 0a86d3579e Change nested check to compare server socket path rather than just assuming
that if $TMUX is set it is nested. From Micah Cowan.
2010-02-06 18:47:41 +00:00
Nicholas Marriott 6789088dce mouse-select-pane has to redraw the borders now too. 2010-01-08 09:14:15 +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
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 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 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 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 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
Nicholas Marriott 390472566c Tidy up and fix some types, prompted by lint via deraadt. 2009-11-13 18:13:18 +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
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 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
Nicholas Marriott 7342615c7d Switch tty fds over to a bufferevent. 2009-11-04 21:47:42 +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
Nicholas Marriott 0785f2872f 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-03 22:40:40 +00:00
Nicholas Marriott 5289da29ba 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-03 20:29:47 +00:00
Nicholas Marriott 37ffdff5ba Move the poll registration functions into the server-*.c files. 2009-10-27 13:03:33 +00:00
Theo Deraadt ed62d1263c tabs are better; ok nicm 2009-10-26 21:42:04 +00:00
Nicholas Marriott 353f2a2ad4 Don't do anything in the client callback if the client has already died to
avoid a use-after-free (the callback is used twice, once for the client itself
and once for the tty). Fixes crashes seen by Han Boetes.
2009-10-26 20:47:00 +00:00
Nicholas Marriott 3c9619bb0a Don't try to continue processing a client if the session has been destroyed. 2009-10-25 22:00:15 +00:00
Nicholas Marriott 3a7636ff0f Remove the -d flag to tmux and just use op/AX to detect default colours.
Irritatingly, although op can be used to tell if a terminal supports default
colours, it can't be used to set them because in some terminfo descriptions it
resets attributes as a side-effect (acts as sgr0) and in others it doesn't, so
it is not possible to determine reliably what the terminal state will be
afterwards. So if AX is missing and op is present, tmux just sends sgr0.

Anyone using -d for a terminal who finds they actually needed it can replace it
using terminal-overrides, but please let me know as it is probably an omission
from terminfo.
2009-10-25 21:11:21 +00:00
Nicholas Marriott 5bed597e61 +time.h. 2009-10-25 17:51:07 +00:00
Nicholas Marriott 1f22a199fb Redraw checks have to after handling input or pane redraw flags set by key
presses will not be acted on.
2009-10-22 21:01:52 +00:00
Nicholas Marriott 9c40a4edc5 The client buffers have to be checked after every event in order to catch the
escape timers and properly reset the cursor.
2009-10-22 20:04:21 +00:00
Nicholas Marriott eddcc3dfa9 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.
2009-10-22 19:41:51 +00:00