summaryrefslogtreecommitdiffstats
path: root/cmd-queue.c
AgeCommit message (Collapse)Author
2017-05-30Rewrite of choose mode, both to simplify and tidy the code and to addnicm
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-01In order that people can use formats like #D in #() in the status linenicm
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-22Get rid of the extra layer of flags and cmd_prepare() and just store thenicm
CMD_FIND_* flags in the cmd_entry and call it for the command. Commands with special requirements call it themselves and update the target for hooks to use.
2017-04-21Log error properly when no current state, and some other minor tweaks.nicm
2017-04-21Clear shared state if not filling it in.nicm
2017-04-21Make the cmd_find_* functions more obvious when looking for a client,nicm
rather than having it inside other functions. Should be no change to the way targets are resolved just yet.
2017-04-21Style nits and an unused struct.nicm
2017-04-21Store state shared between multiple commands in the queue in a sharednicm
structure.
2017-02-03Add a window or pane id "tag" to each format tree and use it to separatenicm
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-01-05Highlight all occurrences of search string after searching in copy mode.nicm
2016-10-18Give each item on queue a name for better logging.nicm
2016-10-16Provide a way for hooks to tag formats onto the commands they fire sonicm
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.nicm
2016-10-16Rewrite command queue handling. Each client still has a command queue,nicm
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-15Drain notifys once at the end of the server loop instead of doing itnicm
from the end of every command queue (which could be nested).
2016-10-14source-file and some other commands can recurse back into cmdq_continue,nicm
which could potentially free the currently running command, so we need to take a reference to it in cmdq_continue_one. Fixes problem reported by Theo Buehler.
2016-10-13Trying to do hooks generically is way too complicated and unreliable andnicm
confusing, particularly trying to automatically figure out what target hooks should be using. So simplify it: - drop before hooks entirely, they don't seem to be very useful; - commands with special requirements now fire their own after hook (for example, if they change session or window, or if they have -t and -s and need to choose which one the hook uses as current target); - commands with no special requirements can have the CMD_AFTERHOOK flag added and they will use the -t state. At the moment new-session, new-window, split-window fire their own hook, and display-message uses the flag. The remaining commands still need to be looked at.
2016-10-13Some improvements and bug fixes for hooks:nicm
- Prepare the state again before the "after" hooks are run, because the command may have killed or moved windows. - Use the hooks list from the newly prepared target, not the old hooks list (only matters for new-session really). - Correctly detect an invalid current state and ignore it in cmd_find_target ("killw; swapw"). - Change neww, new, killp, killw, splitw, swapp, swapw to update the current state (used if no explicit target is given) to something more useful after they have finished. For example, neww changes it to the newly created window. Hooks are still relatively new and primitive so there are likely to be more changes to come. Parts based on bug reports from Uwe Werler and Iblis Lin.
2016-10-11Add static in window-*.c and move some internal functions out of tmux.h.nicm
2016-09-28Couple of vasprintf -> xvasprintf.nicm
2016-04-29Final parts of command hooks, add before- and after- hooks to each command.nicm
2016-01-19Split out getting the current state from the target search so it can benicm
replaced if we already know the current.
2016-01-19I no longer use my SourceForge address so replace it.nicm
2015-12-16Add infrastructure to work out the best target given a pane or windownicm
alone and use it to add pane_died and pane_exited hooks.
2015-12-13If command returns error, report it.nicm
2015-12-13Instead of every command resolving the target (-t or -s) itself, preparenicm
the state (client, session, winlink, pane) for it it before entering the command. Each command provides some flags that tell the prepare step what it is expecting. This is a requirement for having hooks on commands (for example, if you hook "select-window -t1:2", the hook command should to operate on window 1:2 not whatever it thinks is the current window), and should allow some other target improvements. The old cmd_find_* functions remain for the moment but that layer will be dropped later. Joint work with Thomas Adam.
2015-11-27Do not set a limit on the length of commands when printing them.nicm
2015-11-14Push stdout and stderr to clients more aggressively, and add an event tonicm
continue if the send fails.
2015-11-12If we know the terminal outside tmux is not UTF-8, replace UTF-8 innicm
error messages and whatnot with underscores the same as we do when we draw UTF-8 characters as part of the screen.
2015-10-20Use client pointer not file descriptor in logging.nicm
2015-09-16Log when cmdq_continue is called.nicm
2015-09-16Rename cmd_q dead flag to a general flags bitmask (will be more flags later).nicm
2015-06-17Break cmdq_continue inner loop into a helper function.nicm
2015-04-19Rewrite of tmux mouse support which was a mess. Instead of havingnicm
options for "mouse-this" and "mouse-that", mouse events may be bound as keys and there is one option "mouse" that turns on mouse support entirely (set -g mouse on). See the new MOUSE SUPPORT section of the man page for description of the key names and new flags (-t= to specify the pane or window under mouse as a target, and send-keys -M to pass through a mouse event). The default builtin bindings for the mouse are: bind -n MouseDown1Pane select-pane -t=; send-keys -M bind -n MouseDown1Status select-window -t= bind -n MouseDrag1Pane copy-mode -M bind -n MouseDrag1Border resize-pane -M To get the effect of turning mode-mouse off, do: unbind -n MouseDrag1Pane unbind -temacs-copy MouseDrag1Pane The old mouse options are now gone, set-option -q may be used to suppress warnings if mixing configuration files.
2015-02-12Take a reference to prevent cmdq being freed during the command. Cannicm
happen to cfg_cmd_q (possibly others) when source-file recurses into cmdq_continue. Fixes bug reported by Ismail Donmez and Theo Buehler.
2015-02-05There is no need to save the guard state because the function checks itnicm
again anyway.
2014-10-27Move cfg_causes local into cfg.c and remove struct causelist.nicm
2014-10-21Save next item after firing command in case it has added to the queue.nicm
2014-10-20Better format for printf format attributes.nicm
2014-09-01Various minor style and spacing nits.nicm
2014-04-17Remove the "info" message mechanism, this was only used for about fivenicm
mostly useless and annoying messages. Change those commands to silence on success like all the others. Still accept the -q command line flag and "quiet" server option for now.
2014-01-09Remove unnecessary calls to va_start/va_end, from Tiago Cunha.nicm
2013-10-10Alter how tmux handles the working directory to internally use filenicm
descriptors rather than strings. - Each session still has a current working directory. - New sessions still get their working directory from the client that created them or its attached session if any. - New windows are created by default in the session working directory. - The -c flag to new, neww, splitw allows the working directory to be overridden. - The -c flag to attach let's the session working directory be changed. - The default-path option has been removed. To get the equivalent to default-path '.', do: bind c neww -c $PWD To get the equivalent of default-path '~', do: bind c neww -c ~ This also changes the client identify protocol to be a set of messages rather than one as well as some other changes that should make it easier to make backwards-compatible protocol changes in future.
2013-10-10retcode -> retval for exit message.nicm
2013-10-10Support -c for new-session, based on code from J Raynor.nicm
2013-10-10Pass flags into cmdq_guard as an argument since sometimes cmdq->cmd cannicm
be NULL. Avoids crash when a command in a command client can't be parsed.
2013-06-23Mark control commands specially so the client can identify them, basedNicholas Marriott
on a diff from George Nachman a while back.
2013-04-10Fix bug where end guard in control mode was not printed after sessionNicholas Marriott
destroyed, from George Nachman.
2013-03-26Fix compiler warnings, missing #include. From Thomas Adam.Nicholas Marriott
2013-03-25Only send end guard if begin was sent, from George Nachman.Nicholas Marriott