summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-queue.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Now that copy mode copies the pane content rather than keeping anicm2020-04-101-3/+5
| | | | | | | | | | reference to it, it isn't necessary that the pane in copy mode is the same as the one copying from. Add a -s flag to copy-mode to specify a different pane for the source content. This means it is possible to view two places in a pane's history at the same time in different panes, or copy from a pane's history into an editor or shell in the same pane. From Anindya Mukherjee.
* Stop logging the entire command queue every time we add something,nicm2020-04-031-9/+1
| | | | spotted by tb & sthen.
* Send errors to stdout in control mode so they don't get reordered withnicm2020-01-051-2/+5
| | | | other output, reported by George Nachman in GitHub issue 2048.
* When adding a list with multiple commands to the queue, the next item tonicm2019-12-191-8/+17
| | | | | insert after needs to be the last one added, not the first. Reported by Jason Kim in GitHub issue 2023.
* Use the message that has already been built rather than the va_list.nicm2019-12-171-2/+2
|
* Rewrite the code for reading and writing files. Now, if the client isnicm2019-12-121-21/+15
| | | | | | | | | not attached, the server process asks it to open the file, similar to how works for stdin, stdout, stderr. This makes special files like /dev/fd/X work (used by some shells). stdin, stdout and stderr and control mode are now just special cases of the same mechanism. This will also make it easier to use for other commands that read files such as source-file.
* Set up format tree for %if, GitHub issue 1896.nicm2019-09-101-2/+1
|
* Add a cmdq_continue function rather than twiddling the flag directly.nicm2019-06-181-1/+8
|
* Fix warnings, from Ben Boeckel.nicm2019-05-311-2/+2
|
* The line number needs to be updated only after the \n is processed bynicm2019-05-291-9/+21
| | | | | the parser, so store a flag and update it next time around. Also each new line needs its own shared data.
* Client name can actually be NULL, so use address in that case.nicm2019-05-251-2/+5
|
* Use client name when logging command queue.nicm2019-05-251-3/+3
|
* Don't remove group items for group 0 (no group).nicm2019-05-231-1/+3
|
* Replace the split parser code (cfg.c and cmd-string.c) with a singlenicm2019-05-231-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Replace the various identical error callbacks with a single one in cmd-queue.c.nicm2019-05-201-1/+20
|
* Move the single command flag (CMD_CONTROL) into the shared flags.nicm2019-05-181-2/+3
|
* Insert after the right element on queue.nicm2019-05-031-1/+2
|
* Correct ordering when adding after an existing item.nicm2019-05-031-16/+10
|
* Merge hooks into options and make each one an array option. This allowsnicm2019-04-261-2/+56
| | | | | | | 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).
* Break new window and pane creation common code from various commands andnicm2019-04-171-2/+2
| | | | window.c into a separate file spawn.c.
* Allow multiple modes to be open in a pane. A stack of open modes is keptnicm2019-03-121-8/+8
| | | | | | 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.
* Make the mode used to view command output (a variant of copy mode) usenicm2019-03-081-8/+11
| | | | | its own mode definition struct with a different init function rather than calling special setup functions.
* Tidy changing the mode into window_copy_init_for_output.nicm2019-03-071-7/+2
|
* Pass flags into cmd_find_from_* to fix prefer-unattached, reported bynicm2017-08-301-2/+2
| | | | Thomas Sattler.
* Tweak some logging.nicm2017-06-161-1/+3
|
* Rewrite of choose mode, both to simplify and tidy the code and to addnicm2017-05-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* In order that people can use formats like #D in #() in the status linenicm2017-05-011-2/+2
| | | | | | | | | | | | | | 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.
* Get rid of the extra layer of flags and cmd_prepare() and just store thenicm2017-04-221-12/+32
| | | | | | 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.
* Log error properly when no current state, and some other minor tweaks.nicm2017-04-211-4/+4
|
* Clear shared state if not filling it in.nicm2017-04-211-1/+4
|
* Make the cmd_find_* functions more obvious when looking for a client,nicm2017-04-211-5/+6
| | | | | rather than having it inside other functions. Should be no change to the way targets are resolved just yet.
* Style nits and an unused struct.nicm2017-04-211-4/+3
|
* Store state shared between multiple commands in the queue in a sharednicm2017-04-211-13/+19
| | | | structure.
* Add a window or pane id "tag" to each format tree and use it to separatenicm2017-02-031-2/+2
| | | | | | 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.
* Highlight all occurrences of search string after searching in copy mode.nicm2017-01-051-2/+1
|
* Give each item on queue a name for better logging.nicm2016-10-181-4/+16
|
* Provide a way for hooks to tag formats onto the commands they fire sonicm2016-10-161-2/+25
| | | | | that the user can get at additional information - now used for the "hook" format, more to come.
* Mass rename struct cmd_q to struct cmdq_item and related.nicm2016-10-161-106/+106
|
* Rewrite command queue handling. Each client still has a command queue,nicm2016-10-161-197/+294
| | | | | | | | | | | | | | | 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.
* Drain notifys once at the end of the server loop instead of doing itnicm2016-10-151-6/+2
| | | | from the end of every command queue (which could be nested).
* source-file and some other commands can recurse back into cmdq_continue,nicm2016-10-141-3/+10
| | | | | | | 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.
* Trying to do hooks generically is way too complicated and unreliable andnicm2016-10-131-63/+27
| | | | | | | | | | | | | | | | | | 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.
* Some improvements and bug fixes for hooks:nicm2016-10-131-17/+29
| | | | | | | | | | | | | | | | | | | | | - 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.
* Add static in window-*.c and move some internal functions out of tmux.h.nicm2016-10-111-2/+3
|
* Couple of vasprintf -> xvasprintf.nicm2016-09-281-2/+2
|
* Final parts of command hooks, add before- and after- hooks to each command.nicm2016-04-291-8/+50
|
* Split out getting the current state from the target search so it can benicm2016-01-191-2/+2
| | | | replaced if we already know the current.
* I no longer use my SourceForge address so replace it.nicm2016-01-191-2/+2
|
* Add infrastructure to work out the best target given a pane or windownicm2015-12-161-1/+5
| | | | alone and use it to add pane_died and pane_exited hooks.
* If command returns error, report it.nicm2015-12-131-1/+3
|