summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/format.c
AgeCommit message (Collapse)Author
2017-05-30Rewrite of choose mode, both to simplify and tidy the code and to addNicholas Marriott
some modern features. Now the common code is in mode-tree.c, which provides an API used by the three modes now separated into window-{buffer,client,tree}.c. Buffer mode shows buffers, client mode clients and tree mode a tree of sessions, windows and panes. Each mode has a common set of key bindings plus a few that are specific to the mode. Other changes are: - each mode has a preview pane: for buffers this is the buffer content (very useful), for others it is a preview of the pane; - items may be sorted in different ways ('O' key); - multiple items may be tagged and an operation applied to all of them (for example, to delete multiple buffers at once); - in tree mode a command may be run on the selected item (session, window, pane) or on tagged items (key ':'); - displayed items may be filtered in tree mode by using a format (this is used to implement find-window) (key 'f'); - the custom format (-F) for the display is no longer available; - shortcut keys change from 0-9, a-z, A-Z which was always a bit weird with keys used for other uses to 0-9, M-a to M-z. Now that the code is simpler, other improvements will come later. Primary key bindings for each mode are documented under the commands in the man page (choose-buffer, choose-client, choose-tree). Parts written by Thomas Adam.
2017-05-29Add ||, && format operators and C: to search pane content.Nicholas Marriott
2017-05-29Add m: for fnmatch(3) format matching.Nicholas Marriott
2017-05-12Remove an unused variable.Nicholas Marriott
2017-05-12Reset updated flag when restarting job so new output is detected,Nicholas Marriott
reported by Gregory Pakosz in GitHub issue 922.
2017-05-12Only redraw single client, and tweak some logging.Nicholas Marriott
2017-05-12Store copy mode search string in pane so search-again command works evenNicholas Marriott
if you exit and reenter copy mode (it doesn't remember the position, just the search string), suggested by espie@.
2017-05-07Add a format for the name of the pane's mode, lets it be used as aNicholas Marriott
conditional for key bindings.
2017-05-05Add some formats to look at the session window stack, suggested by ScottNicholas Marriott
ROCHFORD.
2017-05-03Add a format for the last search string in copy mode and fix the promptNicholas Marriott
so it can work when in -I, suggested by Suraj N Kurapati.
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-21Store state shared between multiple commands in the queue in a sharedNicholas Marriott
structure.
2017-04-20Now that struct winlink has a session pointer, can remove some arguments.Nicholas Marriott
2017-04-20There is no real need for window_printable_flags to allocate, make itNicholas Marriott
return a buffer from the stack.
2017-04-20If a #() command doesn't exit, use its most recent line of output (itNicholas Marriott
must be a full line). Don't let it redraw the status line more than once a second. Requested by someone about 10 years ago...
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-18Add a format for number of bytes writtent to client, useful for debugging.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.
2017-03-08Add a helper function for the most common format_create/defaults/expandNicholas Marriott
pattern.
2017-02-09Instead of numbering session groups, give them a name which may be givenNicholas Marriott
to -t instead of a target session. Also allow them to contain only one session.
2017-02-07Remove a debugging leftover.Nicholas Marriott
2017-02-03Add a window or pane id "tag" to each format tree and use it to separateNicholas Marriott
jobs, this means that if the same job is used for different windows or panes (for example in pane-border-format), it will be run separately for each pane.
2017-02-01Implement "all event" (1003) mouse mode but in a way that works. TheNicholas Marriott
main issue is that if we have two panes, A with 1002 and B with 1003, we need to set 1003 outside tmux in order to get all the mouse events, but then we need to suppress the ones that pane A doesn't want. This is easy in SGR mouse mode, because buttons == 3 is only used for movement events (for other events the trailing m/M marks a release instead), but in normal mouse mode we can't tell so easily. So for that, look at the previous event instead - if it is drag+release as well, then the current event is a movement event.
2017-01-30When a flag option is used in a format, it should use the number formNicholas Marriott
not string.
2017-01-16getopt() has a struct option so just return to using options_entry.Nicholas Marriott
2017-01-15Major tidy up and rework of options tree and set-option/show-optionsNicholas Marriott
commands this pushes more of the code into options.c and ties it more closely to the options table rather than having an unnecessary split. Also add support for array options (will be used later). Only (intentional) user visible change is that show-options output is now passed through vis(3) with VIS_DQ so quotes are escaped.
2017-01-11Add a format for terminal type.Nicholas Marriott
2017-01-09Add simple comparisons in formats: #{==:a,b} and #{!=:a,b} ("a" and "b"Nicholas Marriott
are expanded so can compare formats). And expand the condition to #{?a,b,c} (the "a" part) if it doesn't work as a simple lookup. Also add FORMAT_NOJOBS flag to disable jobs in a format.
2016-11-17Key running commands for #() by the unexpanded command, and run themNicholas Marriott
again if the expanded form changes (otherwise at most once per second as usual). Fixes issues reported by Gregory Pakosz.
2016-10-16Provide a way for hooks to tag formats onto the commands they fire soNicholas Marriott
that the user can get at additional information - now used for the "hook" format, more to come.
2016-10-16Mass rename struct cmd_q to struct cmdq_item and related.Nicholas Marriott
2016-10-16Rewrite command queue handling. Each client still has a command queue,Nicholas Marriott
but there is also now a global command queue. Instead of command queues being dispatched on demand from wherever the command happens to be added, they are now all dispatched from the top level server loop. Command queues may now also include callbacks as well as commands, and items may be inserted after the current command as well as at the end. This all makes command queues significantly more predictable and easier to use, and avoids the complex multiple nested command queues used by source-file, if-shell and friends. A mass rename of struct cmdq to a better name (cmdq_item probably) is coming.
2016-10-11Some other stuff that can be local to one file.Nicholas Marriott
2016-10-10Loads more static, except for cmd-*.c and window-*.c.Nicholas Marriott
2016-05-23Use a fixed buffer for strftime() because there is no portable way toNicholas Marriott
tell if the buffer is too small, and an expanding buffer is overkill anyway.
2016-04-29Final parts of command hooks, add before- and after- hooks to each command.Nicholas Marriott
2016-01-31Support negative trim values (#{=-10:pane_title}) to trim from the end,Nicholas Marriott
suggested by Kevin Brubeck Unhammer.
2016-01-19I no longer use my SourceForge address so replace it.Nicholas Marriott
2015-12-12Add key-table option to set the default key table for a session, allowsNicholas Marriott
different key bindings for different sessions and a few other things.
2015-12-11Add cmdq as an argument to format_create and add a format for theNicholas Marriott
command name (will also be used for more later).
2015-12-08Remove format_create_flags and just pass flags to format_create.Nicholas Marriott
2015-11-24Remove the -I part of show-messages which isn't really that useful; theNicholas Marriott
server start time can now be accessed with a new start_time format (use: tmux display -p '#{t:start_time}')
2015-11-18Use __unused rather than rolling our own.Nicholas Marriott
2015-11-18Add s/foo/bar/: prefix for formats to substitute bar for foo.Nicholas Marriott
2015-11-13Two spacing and spelling nits.Nicholas Marriott
2015-11-13Add window_visible_layout which ignores zoomed panes and use it forNicholas Marriott
control mode (which needs to know all panes), from George Nachman.
2015-11-13Long overdue change to the way we store cells in the grid: now, insteadNicholas Marriott
of storing a full grid_cell with UTF-8 data and everything, store a new type grid_cell_entry. This can either be the cell itself (for ASCII cells), or an offset into an extended array (per line) for UTF-8 data. This avoid a large (8 byte) overhead on non-UTF-8 cells (by far the majority for most users) without the complexity of the shadow array we had before. Grid memory without any UTF-8 is about half. The disadvantage that cells can no longer be modified in place and need to be copied out of the grid and back but it turned out to be lot less complicated than I expected.
2015-11-12Nuke the utf8 and status-utf8 options and make tmux only a UTF-8Nicholas Marriott
terminal. We still support non-UTF-8 terminals outside tmux, but inside it is always UTF-8 (as when the utf8 and status-utf8 options were on).
2015-11-12Remove the mouse_utf8_flag format as well.Nicholas Marriott
2015-10-31Because pledge(2) does not allow us to pass directory file descriptorsNicholas Marriott
around, we can't use file descriptors for the working directory because we will be unable to pass it to a privileged process to tell it where to read or write files or spawn children. So move tmux back to using strings for the current working directory. We try to check it exists with access() when it is set but ultimately fall back to ~ if it fails at time of use (or / if that fails too).