summaryrefslogtreecommitdiffstats
path: root/cmd.c
AgeCommit message (Collapse)Author
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-10Merge branch 'obsd-master'Thomas Adam
2019-05-10Add support for simple menus usable with mouse or keyboard. New commandnicm
display-menu shows a menu (bound to the mouse on status line by default) and a couple of extra formats for the default menus.
2019-05-08Merge branch 'obsd-master'Thomas Adam
2019-05-08Adjust how mouse targets are found so they always have a session, windownicm
and pane.
2019-05-03Merge branch 'obsd-master'Thomas Adam
2019-05-03Do not store the mouse position we calculate as the start of a drag backnicm
into the mouse event that later code uses, it has been adjusted and they should use the original position. GitHub issue 1710.
2019-05-03Merge branch 'obsd-master'Thomas Adam
2019-05-03Fix mouse positioning when the pane is not entirely visible.nicm
2019-04-25Merge branch 'obsd-master'Thomas Adam
2019-04-25options_array_item_value cannot return NULL.nicm
2019-04-23Merge branch 'obsd-master'Thomas Adam
2019-04-23Indicate an array option with a flag rather than a special type so thatnicm
in future will not have to be strings.
2019-03-18Merge branch 'obsd-master'Thomas Adam
2019-03-18Make array options a sparse tree instead of an array of char * andnicm
remove the size limit.
2018-10-18Support for windows larger than visible on the attached client. This hasnicm
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-08-20Support for windows larger than the client.Nicholas Marriott
This adds 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. 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). 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-width -x or -y. 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 higher memory use if you make a window that big. The minimum size is the size required for the current layout including borders. This change allows some code improvements, most notably that since windows can now never be cropped, that code can be removed from the layout code, and since panes can now never be outside the size of the window, window_pane_visible can be removed.
2018-08-02Merge branch 'obsd-master'Thomas Adam
2018-08-02Log command arguments.nicm
2017-05-31Merge branch 'obsd-master'Thomas Adam
Conflicts: Makefile.am cfg.c server-client.c
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-04-22Merge branch 'obsd-master'Thomas Adam
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-21Merge branch 'obsd-master'Thomas Adam
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-01-24Merge branch 'obsd-master'Thomas Adam
2017-01-24server-info can become an alias rather than a command.nicm
2017-01-16Revert WIP parts of previous I didn't mean to commit yet.nicm
2017-01-16getopt() has a struct option so just return to using options_entry.nicm
2017-01-10Merge branch 'obsd-master'Thomas Adam
2017-01-10Need to escape ; twice because the command list parser will eat one,nicm
reported by Theo Buehler.
2017-01-10Merge branch 'obsd-master'Thomas Adam
2017-01-10Quote backslash as well for %%%.nicm
2017-01-06Merge branch 'obsd-master'Thomas Adam
2017-01-06Incremental search in copy mode (on for emacs keys by default) - muchnicm
the same as normal searching but updates the cursor position and marked search terms as you type. C-r and C-s in the prompt repeat the search, once finished searching (with Enter), N and n work as before.
2016-12-28Merge branch 'obsd-master'Thomas Adam
2016-12-28Fix the prefer unattached session behaviour ofnicm
attach-session/switch-client, reported by Thomas Sattle.
2016-11-02Merge branch 'obsd-master'Thomas Adam
2016-11-02Make an empty state on error rather than leaving something partiallynicm
created (which now is now a fatal() later).
2016-10-21Merge branch 'obsd-master'Thomas Adam
2016-10-21Add %%% to substitute with quotes escaped (convert " to \"). Use thisnicm
for the prompts in copy mode. Fixes problems with jumping to ' reported by Theo Buehler.
2016-10-16Merge branch 'obsd-master'Thomas Adam
2016-10-16Mass rename struct cmd_q to struct cmdq_item and related.nicm
2016-10-16Merge branch 'obsd-master'Thomas Adam
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-13Merge branch 'obsd-master'Thomas Adam
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-05Merge branch 'obsd-master'Thomas Adam
2016-10-05Allow cmd_mouse_at return arguments to be NULL.nicm
2016-03-02Merge branch 'obsd-master'Thomas Adam
Conflicts: utf8.c