summaryrefslogtreecommitdiffstats
path: root/cmd-queue.c
AgeCommit message (Collapse)Author
2019-05-25Client name can actually be NULL, so use address in that case.nicm
2019-05-25Use client name when logging command queue.nicm
2019-05-23Don't remove group items for group 0 (no group).nicm
2019-05-23Replace the split parser code (cfg.c and cmd-string.c) with a singlenicm
parser using yacc(1). This is a major change but is clearer and simpler and allows some edge cases to be made more consistent, as well as tidying up how aliases are handled. It will also allow some further improvements later. Entirely the same parser is now used for parsing the configuration file and for string commands. This means that constructs previously only available in .tmux.conf, such as %if, can now be used in string commands (for example, those given to if-shell - not commands invoked from the shell, they are still parsed by the shell itself). The only syntax change I am aware of is that #{} outside quotes or a comment is now considered a format and not a comment, so #{ is now a syntax error (notably, if it is at the start of a line). This also adds two new sections to the man page documenting the syntax and outlining how parsing and command execution works. Thanks to everyone who sent me test configs (they still all parse without errors - but this doesn't mean they still work as intended!). Thanks to Avi Halachmi for testing and man page improvements, also to jmc@ for reviewing the man page changes.
2019-05-20Replace the various identical error callbacks with a single one in cmd-queue.c.nicm
2019-05-18Move the single command flag (CMD_CONTROL) into the shared flags.nicm
2019-05-03Insert after the right element on queue.nicm
2019-05-03Correct ordering when adding after an existing item.nicm
2019-04-26Merge hooks into options and make each one an array option. This allowsnicm
multiple commands to be easily bound to one hook. set-hook and show-hooks remain but they are now variants of set-option and show-options. show-options now has a -H flag to show hooks (by default they are not shown).
2019-04-17Break new window and pane creation common code from various commands andnicm
window.c into a separate file spawn.c.
2019-03-12Allow multiple modes to be open in a pane. A stack of open modes is keptnicm
and the previous restored when the top is exited. If a mode that is already on the stack is entered, the existing instance is moved to the top as the active mode rather than being opened new.
2019-03-08Make the mode used to view command output (a variant of copy mode) usenicm
its own mode definition struct with a different init function rather than calling special setup functions.
2019-03-07Tidy changing the mode into window_copy_init_for_output.nicm
2017-08-30Pass flags into cmd_find_from_* to fix prefer-unattached, reported bynicm
Thomas Sattler.
2017-06-16Tweak some logging.nicm
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.