summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-client.c
AgeCommit message (Collapse)Author
2019-02-16Use starting client cwd in config file, GitHub issue 1606.Nicholas Marriott
2018-12-18Pass window into mode functions.Nicholas Marriott
2018-11-19evbuffer_new and bufferevent_new can both fail (when malloc fails) andNicholas Marriott
return NULL. GitHub issue 1547.
2018-11-07If a non-repeating key is used when repeating, it should be treated asNicholas Marriott
an entirely new key press, not checked in root table and ignored if not found. GitHub issue 1513.
2018-10-18Support for windows larger than visible on the attached client. This hasNicholas Marriott
been a limitation for a long time. There are two new options, window-size and default-size, and a new command, resize-window. The force-width and force-height options and the session_width and session_height formats have been removed. The new window-size option tells tmux how to work out the size of windows: largest means it picks the size of the largest session, smallest the smallest session (similar to the old behaviour) and manual means that it does not automatically resize windows. The default is currently largest but this may change. aggressive-resize modifies the choice of session for largest and smallest as it did before. If a window is in a session attached to a client that is too small, only part of the window is shown. tmux attempts to keep the cursor visible, so the part of the window displayed is changed as the cursor moves (with a small delay, to try and avoid excess redrawing when applications redraw status lines or similar that are not currently visible). The offset of the visible portion of the window is shown in status-right. Drawing windows which are larger than the client is not as efficient as those which fit, particularly when the cursor moves, so it is recommended to avoid using this on slow machines or networks (set window-size to smallest or manual). The resize-window command can be used to resize a window manually. If it is used, the window-size option is automatically set to manual for the window (undo this with "setw -u window-size"). resize-window works in a similar way to resize-pane (-U -D -L -R -x -y flags) but also has -a and -A flags. -a sets the window to the size of the smallest client (what it would be if window-size was smallest) and -A the largest. For the same behaviour as force-width or force-height, use resize-window -x or -y, and "setw -u window-size" to revert to automatic sizing.. If the global window-size option is set to manual, the default-size option is used for new windows. If -x or -y is used with new-session, that sets the default-size option for the new session. The maximum size of a window is 10000x10000. But expect applications to complain and much higher memory use if making a window excessively big. The minimum size is the size required for the current layout including borders. The refresh-client command can be used to pan around a window, -U -D -L -R moves up, down, left or right and -c returns to automatic cursor tracking. The position is reset when the current window is changed.
2018-09-11Do not check for mouse events on pane borders when zoomed, based on aNicholas Marriott
fix from Avi Halachmi.
2018-08-29Keep any text killed in the command prompt with C-w and yank it withNicholas Marriott
C-y, only use the top buffer if no text has previously been killed. This and previous change promped by discussion with kn@.
2018-08-22Add StatusLeft and StatusRight mouse key modifiers for the left andNicholas Marriott
right parts of the status line.
2018-08-19Add a flag to force redrawing of the status line even if the contentNicholas Marriott
hasn't changed, needed for resizing.
2018-08-19Add a client redraw-window flag instead of the redraw-all flag and forNicholas Marriott
all just use the three flags together (window, borders, status).
2018-08-18SESSION_UNATTACHED flag is no longer necessary now we have an attachedNicholas Marriott
count instead.
2018-08-02Make key trees and some other bits static.Nicholas Marriott
2018-07-17When a key isn't in the first table, we need to try the same key againNicholas Marriott
not the any key. Also rename some labels. Fixes GitHub issue 1406 reeported by Mark Kelly.
2018-07-16Add an "Any" key to run a command if a key is pressed that is not boundNicholas Marriott
in the current key table. GitHub issue 1404.
2018-07-04Add pane focus hooks.Nicholas Marriott
2018-05-24Make server_client_get_cwd used (almost) everywhere we need to work outNicholas Marriott
the cwd, and do not fall back to "." as it is pretty useless. GitHub issue 1331.
2018-03-08Add a missing client-detached hook when the server shuts down, and doNicholas Marriott
not exit until jobs started from run-shell/if-shell have finished (add a job flags member and a flag to indicate other jobs). GitHub issue 1245.
2018-02-22Check prefix when retrying so it is checked while repeat flag isNicholas Marriott
set. GitHub issue 1239.
2018-02-05Add struct status_line to hold status line members of struct client, notNicholas Marriott
used yet but will be soon. From Thomas Adam.
2017-12-19Report better error from server when socket create fails, GitHub issueNicholas Marriott
1201.
2017-10-16Infrastructure for drawing status lines of more than one line in height,Nicholas Marriott
still only one is allowed but this lets tmux draw bigger ones.
2017-09-06Do not attempt to use TIOCSWINSZ on a -1 file descriptor (possible ifNicholas Marriott
the pane has already died).
2017-08-30Pass flags into cmd_find_from_* to fix prefer-unattached, reported byNicholas Marriott
Thomas Sattler.
2017-08-16Add -d flag to display-panes to specify timeout, and make 0 mean noNicholas Marriott
timeout. From Laurens Post.
2017-07-14Fix redraw defer code in the presence of multiple clients - the timerNicholas Marriott
may be needed for all of them, so don't delete it on the first; and don't skip setting the redraw flag if the timer is already running. Reported by Pol Van Aubel in GitHub issue 1003.
2017-07-12proc_send_s now seems unnecessary.Nicholas Marriott
2017-06-13Remove xterm flag from key before checking prefix, reported by PeterNicholas Marriott
Fern in GitHub issue 974.
2017-06-06Continue and pass keys through if they are repeated keys, so that theNicholas Marriott
first key after a repeated key doesn't get lost.
2017-05-31Some applications like vi(1) and tmux until 10 minutes or so ago, do notNicholas Marriott
redraw on SIGWINCH if the size returns to the original size between the original SIGWINCH and when they get around to calling TIOCGWINSZ. So use the existing resize timer to introduce a small delay between the two resizes.
2017-05-31It is not OK to ignore SIGWINCH if SIOCGWINSZ reports the size hasNicholas Marriott
unchanged, because it may have changed and changed back in the time between us getting the signal and calling ioctl(). Always redraw when we see SIGWINCH.
2017-05-31Because we defer actually resizing applications (calling TIOCSWINSZ)Nicholas Marriott
until the end of the server loop, tmux may have gone through several internal resizes in between. This can be a problem if the final size is the same as the initial size (what the application things it currently is), because the application may choose not to redraw, assuming the screen state is unchanged, when in fact tmux has thrown away parts of the screen, assuming the application will redraw them. To avoid this, do an extra resize if the new size is the same size as the initial size. This should force the application to redraw when tmux needs it to, while retaining the benefits of deferring (so we now resize at most two times instead of at most one - and only two very rarely). Fixes a problem with break-pane and zoomed panes reported by Michal Mazurek.
2017-05-29Store a copy of the old status line, will be needed soon for new choose mode.Nicholas Marriott
2017-05-29Function to count clients.Nicholas Marriott
2017-05-16Line length and spaces to tabs.Nicholas Marriott
2017-05-10Insert copy mode bindings at the right place in the command queue.Nicholas Marriott
2017-05-09If the current screen was complex enough, it was possible to make redrawNicholas Marriott
itself hit the "terminal can't keep up" check. To avoid this, record how much data we send during redraw (we know we will be starting with 0) and skip the check until it has been flushed. GitHub issue 912.
2017-05-07Up to now, tmux sees \033\033[OA as M-Up and since we turned onNicholas Marriott
xterm-keys by default, generates \033[1;3A instead of \033\033[OA. Unfortunately this confuses vi, which doesn't understand xterm keys and now sees Escape+Up pressed within escape-time as Escape followed by A. The issue doesn't happen in xterm itself because it gets the keys from X and can distinguish between a genuine M-Up and Escape+Up. Because xterm can, tmux can too: xterm will give us \033[1;3A (that is, kUP3) for a real M-Up and \033\033OA for Escape+Up - in fact, we can be sure any \033 preceding an xterm key is a real Escape key press because Meta would be part of the xterm key instead of a separate \033. So change tmux to recognise both sequences as M-Up for its own purposes, but generate the xterm version of M-Up only if it originally received the xterm version from the terminal. This means we will return to sending \033\033OA instead of the xterm key for terminals that do not support xterm keys themselves, but there is no practical way around this because they do not allow us to distinguish between Escape+Up and M-Up. xterm style escape sequences are now the de facto standard for these keys in any case. Problem reported by jsing@ and subsequently by Cecile Tonglet in GitHub issue 907.
2017-05-01In order that people can use formats like #D in #() in the status lineNicholas Marriott
and not have to wait for an update when they change pane, we allow commands to run more than once a second if the expanded form changes. Unfortunately this can mean them being run far too often (pretty much continually) when multiple clients exist, because some formats (including #D) will always differ between clients. To avoid this, give each client its own tree of jobs which means that the same command will be different instances for each client - similar to how we have the tag to separate commands for different panes. GitHub issue 889; test case reported by Paul Johnson.
2017-04-22Mouse bindings and hooks set up an initial current state when running aNicholas Marriott
command. This is used for the session, window and pane for all commands in the command sequence if there is no -t or -s. However, using it for all commands in the command sequence means that if the active pane or current session is changed, subsequent commands still use the previous state. So make commands which explicitly change the current state (such as neww and selectp) update it themselves for later commands. Commands which may invalidate the state (like killp) are already OK because an invalid state will be ignored. Also fill in the current state for all key bindings rather than just the mouse, so that any omissions are easier to spot.
2017-04-21Log error properly when no current state, and some other minor tweaks.Nicholas Marriott
2017-04-21Key needs to be initialized to zero now it has flags in it.Nicholas Marriott
2017-04-21Add cmd_find_from_winlink_pane and use it in a couple of places, andNicholas Marriott
make functions that can't fail void.
2017-04-21It is annoying that the copy mode key table (or any other key table)Nicholas Marriott
will suppress root key table bindings. So change to always check the root table if no binding is found in the current table (whether it be the prefix table from pressing the prefix or the copy mode table from a pane). A root key binding can be blocked by binding the key to a command that does nothing (like send-keys with no arguments). Problem reported by Thomas Sattler.
2017-04-21Store state shared between multiple commands in the queue in a sharedNicholas Marriott
structure.
2017-04-20Only set up a current target for mouse key bindings. Fixes:Nicholas Marriott
bind q select-pane -U \; resize-pane -Z (There is still some possible weirdness with the way we do current targets, it should probably be done in a different way at some point.)
2017-04-19Add a suspend helper function, and do not allow detaching or suspendingNicholas Marriott
while already doing so.
2017-04-19When the data we have buffered to write to a terminal grows beyond aNicholas Marriott
reasonable amount (currently width * height * 8 bytes), discard all output to the terminal and start trying to redraw periodically instead. Continue with this until the amount of data we are trying to write falls to a low level again. This helps to prevent tmux sitting on a huge buffer of data when there are processes with fast output running inside tmux but the outside terminal is slow. A new client_discarded format holds the amount of data that has been discarded due to this mechanism. The three variables (when to start this, when to stop, and how often to redraw) are basically "works for me" at the moment, this is going in to see how it goes and if it causes problems for anyone else.
2017-04-18On terminals without DECSLRM, when a pane that is less than the fullNicholas Marriott
with of the terminal scrolls, tmux needs to redraw the entire pane. This results in a large amount of output data which can cause slow terminals to struggle, particularly when many lines are scrolled together quickly. This can be reduced by only redrawing when tmux doesn't hold any buffered data for the terminal. If a redraw is required and data is buffered, the redraw is deferred until all that data is consumed (it is checked after every event loop, a timer is used to ensure this happens at some point). While a redraw is pending, no additional data will be written to the terminal. The redraw still happens, now it is just pushed back if it is possible it would just add more data on top of a terminal that is already behind. This both gives the terminal a chance to catch up, and allows tmux to process more scrolling (that would require additional redraws) in the meantime. Helps with a problem reported by Greg Hurrell.
2017-04-17Remove a couple of redraw flags that no longer have any effect.Nicholas Marriott
2017-04-05Give each client a name. This defaults to the tty name as before butNicholas Marriott
falls back to an alternative if the tty name is not available. This is clearer than overloading the client ttyname member and allows us to remove the path stored in the tty struct, it should always be the same as the client.