Commit Graph

82 Commits (0a8571b6fe4fdd4e741605f1f2b44344bd8edeb8)

Author SHA1 Message Date
nicm 71d453f169 Add -c to run-shell to set working directory, from someone in GitHub
issue 3661.
2023-08-23 08:40:25 +00:00
nicm 18838fbc87 Do not attempt to use client in config file (it will be NULL), GitHub
issue 3206.
2022-06-02 21:19:32 +00:00
nicm cd89000c1d Add a way for lines added to copy mode to be passed through the parser
to handle escape sequences and use it for run-shell, GitHub issue 3156.
2022-05-30 13:00:18 +00:00
nicm 759efe1b33 Add -e flag to set environment for popup, from Alexis Hildebrandt in
GitHub issue 2924.
2021-10-11 10:55:30 +00:00
nicm 3c3d371f99 Fix run-shell -d with no command, GitHub issue 2885. 2021-09-16 06:39:22 +00:00
nicm a19cac5c46 For the moment, restore if-shell and run-shell to parsing at the last
moment (when the shell command completes) rather than when first
invoked, GitHub issue 2872.
2021-09-15 07:38:30 +00:00
nicm 34312fd6ee Expand argument to run-shell again. 2021-09-09 13:38:32 +00:00
nicm 03d173cbd8 Validate command argument types (string or command list) and give more
useful error messages.
2021-08-25 08:51:55 +00:00
nicm 210e71edf3 Move command argument parsing common functions and don't bother to parse
again if given a command rather than a string.
2021-08-23 12:33:55 +00:00
nicm 08e6360f23 Add args parsing callback for some future work, currently unused. 2021-08-21 10:22:38 +00:00
nicm 5f32b7d961 Hide struct args behind a couple of accessor functions. 2021-08-20 19:50:16 +00:00
nicm a2b8506917 Set return code for confirm-before and make command-prompt also block,
GitHub issue 2822.
2021-08-13 06:50:42 +00:00
nicm e6abe55134 Add a flag to disable keys to close a message, GitHub issue 2625. 2021-04-12 09:36:12 +00:00
nicm 9017af2355 Do not crash if there is no item to show command error, from Anindya
Mukherjee.
2021-03-15 13:06:33 +00:00
nicm c44750792a Drop support for popups where the content is provided directly to tmux
(which does not have many practical uses) and only support running a
program in the popup. display-popup is now simpler and can accept
multiple arguments to avoid escaping problems (like the other commands).
2021-03-02 10:56:45 +00:00
nicm 606bd5f8c6 Add a -C flag to run-shell to use a tmux command rather than a shell command. 2021-01-01 08:36:51 +00:00
nicm d52ac7d027 Do not wait on shutdown for commands started with run -b. 2020-06-12 10:31:12 +00:00
nicm d67245c734 Add a customize mode where keys and options may be browsed and changed,
includes adding a brief description of each option. Bound to "C" by
default.
2020-05-16 16:02:24 +00:00
nicm 3f7f9a0e20 Make client -c and -t handling common in cmd-queue.c and try to be
clearer about whether the client is the target client (must have a
session) or not.
2020-04-13 20:51:57 +00:00
nicm 04cdd03525 Also move cmdq_item and cmdq_list into cmd-queue.c (this is to make its
use more clearly defined and preparation for some future work).
2020-04-13 10:59:58 +00:00
nicm c20eb0c0ae Make struct cmd local to cmd.c and move it out of tmux.h. 2020-04-13 08:26:27 +00:00
nicm c0602f357d Now that copy mode copies the pane content rather than keeping a
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.
2020-04-10 07:44:26 +00:00
nicm 5aeab5ab40 Preserve exit status from run-shell and pass to the client. 2020-03-21 13:15:38 +00:00
nicm e8273a993e Add a flag to run a background process in a pty as well, not used for
anything yet.
2020-03-19 13:43:18 +00:00
nicm fa36e9bc88 Do not add a reference to the session if no session is present. 2020-03-13 06:19:33 +00:00
nicm 516f6099fc Add a -d flag to run-shell to wait for delay before running the command,
also allow run-shell to accept no command to just delay.
2020-03-12 13:25:45 +00:00
nicm 9272fe36e2 Add a cmdq_continue function rather than twiddling the flag directly. 2019-06-18 11:08:42 +00:00
nicm 3f6bfbaf2b Allow multiple modes to be open in a pane. A stack of open modes is kept
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-12 11:16:49 +00:00
nicm de730f68a4 Make the mode used to view command output (a variant of copy mode) use
its own mode definition struct with a different init function rather
than calling special setup functions.
2019-03-08 10:34:20 +00:00
nicm 3c24bc5617 Tidy changing the mode into window_copy_init_for_output. 2019-03-07 19:34:22 +00:00
nicm 79d2351ce8 Memory leaks, from Gang Fan in GitHub issue 1453. 2018-08-27 11:03:34 +00:00
nicm bceccc6b63 Move job struct into job.c. 2018-08-23 15:45:05 +00:00
nicm b9a6162d2f Make server_client_get_cwd used (almost) everywhere we need to work out
the cwd, and do not fall back to "." as it is pretty useless. GitHub
issue 1331.
2018-05-24 09:42:49 +00:00
nicm 19f3a5c612 Add a missing client-detached hook when the server shuts down, and do
not exit until jobs started from run-shell/if-shell have finished (add a
job flags member and a flag to indicate other jobs). GitHub issue 1245.
2018-03-08 08:09:10 +00:00
nicm 17cf1b21c6 Pass flags into cmd_find_from_* to fix prefer-unattached, reported by
Thomas Sattler.
2017-08-30 10:33:57 +00:00
nicm aad4e4ddb1 Rewrite of choose mode, both to simplify and tidy the code and to add
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-30 21:44:59 +00:00
nicm ee45a8a149 Get rid of the extra layer of flags and cmd_prepare() and just store the
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-22 10:22:39 +00:00
nicm efaf4c16cf Make the cmd_find_* functions more obvious when looking for a client,
rather than having it inside other functions. Should be no change to the
way targets are resolved just yet.
2017-04-21 20:26:34 +00:00
nicm 0b44ad99b5 If a #() command doesn't exit, use its most recent line of output (it
must be a full line). Don't let it redraw the status line more than once
a second.

Requested by someone about 10 years ago...
2017-04-20 09:20:22 +00:00
nicm 6b2009ad72 Add a helper function for the most common format_create/defaults/expand
pattern.
2017-03-08 13:36:12 +00:00
nicm 8b8d0963da Style nits. 2017-02-16 10:53:25 +00:00
nicm 7d23d019c0 Add a window or pane id "tag" to each format tree and use it to separate
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-02-03 11:57:27 +00:00
nicm db2412e2ac Apply the right fix for run -b, used the wrong diff before. 2016-11-12 19:05:53 +00:00
nicm 36f8fa316d Do not crash with run-shell -b and no window pane available, reported by
Sergei Dyshel.
2016-11-11 11:37:25 +00:00
nicm b342bd0b46 Mass rename struct cmd_q to struct cmdq_item and related. 2016-10-16 19:04:05 +00:00
nicm ddc4512d2e Rewrite command queue handling. Each client still has a command queue,
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-16 17:55:14 +00:00
nicm bfe14b5312 Only use pane with run-shell if -t is given. 2016-10-15 23:06:39 +00:00
nicm a81685bfac Add static in cmd-* and fix a few other nits. 2016-10-10 21:51:39 +00:00
nicm 1db6d6fea6 Pass file/line to new command for if-shell so that errors appear
sensibly.
2016-10-09 08:06:51 +00:00
nicm 4f6bc0a0a9 Expand client formats in run-shell. 2016-02-12 12:24:52 +00:00