summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-split-window.c
AgeCommit message (Collapse)Author
2020-04-13Make client -c and -t handling common in cmd-queue.c and try to beNicholas Marriott
clearer about whether the client is the target client (must have a session) or not.
2020-04-13Move cmdq_state into cmd-queue.c.Nicholas Marriott
2020-04-13Rename cmdq_shared to cmdq_state which will better reflect what it isNicholas Marriott
(going to be) used for.
2020-04-13Also move cmdq_item and cmdq_list into cmd-queue.c (this is to make itsNicholas Marriott
use more clearly defined and preparation for some future work).
2020-04-13Make struct cmd local to cmd.c and move it out of tmux.h.Nicholas Marriott
2020-03-31Add a way to mark environment variables as "hidden" so they can be usedNicholas Marriott
by tmux but are not passed into the environment of new panes.
2020-03-16Do not attempt to close a NULL pane when failing to create a new one.Nicholas Marriott
2019-10-15Add support for percentage sizes for resize-pane ("-x 10%"). Also changeNicholas Marriott
split-window and join-pane -l to accept similar percentages and deprecate -p. From Anindya Mukherjee.
2019-05-03Allow panes to be empty (no command), output can be piped to them withNicholas Marriott
split-window or display-message -I.
2019-04-28Support multiple occurances of the same argument. Use this for a newNicholas Marriott
flag -e to new-window, split-window, respawn-window, respawn-pane to pass environment variables into the newly created process. From Steffen Christgau in GitHub issue 1697.
2019-04-26Merge hooks into options and make each one an array option. This allowsNicholas Marriott
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 andNicholas Marriott
window.c into a separate file spawn.c.
2018-10-18Support for windows larger than visible on the attached client. This hasNicholas Marriott
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-05-24Make server_client_get_cwd used (almost) everywhere we need to work outNicholas Marriott
the cwd, and do not fall back to "." as it is pretty useless. GitHub issue 1331.
2018-03-16Insert full size panes at the right position, from KOIE Hidetaka inNicholas Marriott
GitHub issue 1284.
2018-03-01Expand formats in window and session names.Nicholas Marriott
2017-08-30Pass flags into cmd_find_from_* to fix prefer-unattached, reported byNicholas Marriott
Thomas Sattler.
2017-07-21Add -c for respawn-pane and respawn-window, from J Raynor.Nicholas Marriott
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-04-25Do not update TERM into config file parsing has finished.Nicholas Marriott
2017-04-22Get rid of the extra layer of flags and cmd_prepare() and just store theNicholas Marriott
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-22Mouse bindings and hooks set up an initial current state when running aNicholas Marriott
command. This is used for the session, window and pane for all commands in the command sequence if there is no -t or -s. However, using it for all commands in the command sequence means that if the active pane or current session is changed, subsequent commands still use the previous state. So make commands which explicitly change the current state (such as neww and selectp) update it themselves for later commands. Commands which may invalidate the state (like killp) are already OK because an invalid state will be ignored. Also fill in the current state for all key bindings rather than just the mouse, so that any omissions are easier to spot.
2017-04-21Add cmd_find_from_winlink_pane and use it in a couple of places, andNicholas Marriott
make functions that can't fail void.
2017-03-09Move server_fill_environ into environ.c and move some other common codeNicholas Marriott
into it.
2017-03-08Add a helper function for the most common format_create/defaults/expandNicholas Marriott
pattern.
2017-02-27If splitw -b is used, insert the new pane before the current one in theNicholas Marriott
pane list. This means the numbering is in order (for example for display-panes) and fixes a problem with redrawing the active pane borders.
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.
2016-10-16Use the notify name string instead of going via an enum and changeNicholas Marriott
existing hooks to use notifys instead.
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-13Trying to do hooks generically is way too complicated and unreliable andNicholas Marriott
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:Nicholas Marriott
- 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-10Add static in cmd-* and fix a few other nits.Nicholas Marriott
2016-09-04Add support for performing a full width split (with splitw -f), ratherNicholas Marriott
than splitting the current cell. From Stephen Kent.
2016-06-06Insert new panes after the pane being split in the list rather thanNicholas Marriott
always after the active pane. This is more sensible when doing it with commands rather than keys.
2016-01-19I no longer use my SourceForge address so replace it.Nicholas Marriott
2015-12-14Instead of combined flags for -c, -s, -t, split into different setsNicholas Marriott
using an enum and simplify the parsing code.
2015-12-13Use member names in cmd_entry definitions so I stop getting confusedNicholas Marriott
about the order.
2015-12-13Instead of every command resolving the target (-t or -s) itself, prepareNicholas Marriott
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-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-10-31Fall back silently to ~ or / rather than checking -c with access(), thisNicholas Marriott
was the old behaviour.
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).
2015-10-28Like options, move the environ struct into environ.c.Nicholas Marriott
2015-10-27Move struct options into options.c.Nicholas Marriott
2015-10-23Remove some unnecessary checks before free().Nicholas Marriott
2015-04-26Remove panes from layout if spawning them fails, reported by Anthony JNicholas Marriott
Bentley.
2015-02-05Remove a couple of now-unused variables.Nicholas Marriott
2015-02-05Wrap all the individual format_* calls in a single format_defaultsNicholas Marriott
functions.
2014-11-12Add -b to splitw like joinw, from Felix Rosencrantz.Nicholas Marriott