OpenBSD CVS

CVS log for src/usr.bin/tmux/cmd-queue.c


[BACK] Up to [local] / src / usr.bin / tmux

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.117 / (download) - annotate - [select for diffs], Tue May 14 07:52:19 2024 UTC (5 days, 5 hours ago) by nicm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.116: +12 -3 lines
Diff to previous 1.116 (colored)

Add a command-error hook when a command fails, from Hugh Davenport in
GitHub issue 3973.

Revision 1.116 / (download) - annotate - [select for diffs], Tue Apr 23 13:34:51 2024 UTC (3 weeks, 4 days ago) by jsg
Branch: MAIN
Changes since 1.115: +5 -5 lines
Diff to previous 1.115 (colored)

correct indentation; no functional change
ok tb@

Revision 1.115 / (download) - annotate - [select for diffs], Fri Sep 15 06:31:49 2023 UTC (8 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.114: +4 -2 lines
Diff to previous 1.114 (colored)

Add -t to source-file, GitHub issue 3473.

Revision 1.114 / (download) - annotate - [select for diffs], Sun Feb 5 21:15:32 2023 UTC (15 months, 1 week ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.113: +2 -63 lines
Diff to previous 1.113 (colored)

Extend display-message to work for control clients. GitHub issue 3449.

Revision 1.113 / (download) - annotate - [select for diffs], Tue Jan 3 11:43:24 2023 UTC (16 months, 2 weeks ago) by nicm
Branch: MAIN
Changes since 1.112: +3 -2 lines
Diff to previous 1.112 (colored)

Query the client terminal for foreground and background colours and if
OSC 10 or 11 is received but no colour has been set inside tmux, return
the colour from the first attached client (probably most people will
have all light or or all dark terminals).

Revision 1.112 / (download) - annotate - [select for diffs], Fri Dec 16 08:22:05 2022 UTC (17 months ago) by nicm
Branch: MAIN
Changes since 1.111: +2 -2 lines
Diff to previous 1.111 (colored)

Do not escape tabs in output (iTerm2 needs them). GitHub issue 3414.

Revision 1.111 / (download) - annotate - [select for diffs], Wed Dec 7 09:44:44 2022 UTC (17 months, 1 week ago) by nicm
Branch: MAIN
Changes since 1.110: +72 -26 lines
Diff to previous 1.110 (colored)

Process escape sequences in show-buffer, GitHub issue 3401.

Revision 1.110 / (download) - annotate - [select for diffs], Mon May 30 13:00:18 2022 UTC (23 months, 2 weeks ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.109: +2 -2 lines
Diff to previous 1.109 (colored)

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.

Revision 1.109 / (download) - annotate - [select for diffs], Mon May 30 12:55:25 2022 UTC (23 months, 2 weeks ago) by nicm
Branch: MAIN
Changes since 1.108: +2 -2 lines
Diff to previous 1.108 (colored)

Spacing/style nits.

Revision 1.108 / (download) - annotate - [select for diffs], Mon May 30 12:48:57 2022 UTC (23 months, 2 weeks ago) by nicm
Branch: MAIN
Changes since 1.107: +22 -6 lines
Diff to previous 1.107 (colored)

Add an ACL list for users connecting to the tmux socket. Users may be
forbidden from attaching, forced to attach read-only, or allowed to
attach read-write. A new command, server-access, configures the list.
tmux gets the user using getpeereid(3) of the client socket. Users must
still configure file system permissions manually. From Dallas Lyons and
others.

Revision 1.107 / (download) - annotate - [select for diffs], Sat Aug 21 17:25:32 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.106: +11 -2 lines
Diff to previous 1.106 (colored)

Stop caring about empty commands, just treat as a null command.

Revision 1.106 / (download) - annotate - [select for diffs], Sat Aug 21 10:28:05 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.105: +2 -2 lines
Diff to previous 1.105 (colored)

Rename a member to match what it will be in future.

Revision 1.105 / (download) - annotate - [select for diffs], Fri Aug 20 19:50:16 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.104: +4 -4 lines
Diff to previous 1.104 (colored)

Hide struct args behind a couple of accessor functions.

Revision 1.104 / (download) - annotate - [select for diffs], Fri Aug 20 18:59:53 2021 UTC (2 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.103: +9 -9 lines
Diff to previous 1.103 (colored)

Expose args_value struct (will be needed soon) and add some missing frees.

Revision 1.103 / (download) - annotate - [select for diffs], Thu Aug 12 08:05:11 2021 UTC (2 years, 9 months ago) by nicm
Branch: MAIN
Changes since 1.102: +10 -1 lines
Diff to previous 1.102 (colored)

Move hook format setup earlier and add a hook_client, GitHub issue 2809.

Revision 1.102 / (download) - annotate - [select for diffs], Mon Apr 12 09:36:12 2021 UTC (3 years, 1 month ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.101: +2 -2 lines
Diff to previous 1.101 (colored)

Add a flag to disable keys to close a message, GitHub issue 2625.

Revision 1.101 / (download) - annotate - [select for diffs], Wed Apr 7 12:50:12 2021 UTC (3 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.100: +2 -2 lines
Diff to previous 1.100 (colored)

Add a current_file format for the config file being parsed. Originally
suggested by kn@, also GitHub issue 2638.

Revision 1.100 / (download) - annotate - [select for diffs], Mon Nov 30 13:37:45 2020 UTC (3 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.99: +6 -2 lines
Diff to previous 1.99 (colored)

Ignore running command when checking for no-hooks flag if it is blocked.
GitHub issue 2483.

Revision 1.99 / (download) - annotate - [select for diffs], Mon Jul 27 08:03:10 2020 UTC (3 years, 9 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (colored)

Add a -d option to display-message to set delay, from theonekeyg at
gmail dot com in GitHub issue 2322.

Revision 1.98 / (download) - annotate - [select for diffs], Mon Jun 1 09:43:01 2020 UTC (3 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.97: +7 -4 lines
Diff to previous 1.97 (colored)

Instead of sending all data to control mode clients as fast as possible,
add a limit of how much data will be sent to the client and try to use
it for panes with some degree of fairness. GitHub issue 2217, with
George Nachman.

Revision 1.97 / (download) - annotate - [select for diffs], Sat May 16 16:35:13 2020 UTC (4 years ago) by nicm
Branch: MAIN
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

Separate key flags and modifiers, log key flags, make the "xterm" flag
more explicit and fix M- keys with a leading escape.

Revision 1.96 / (download) - annotate - [select for diffs], Sat May 16 16:20:59 2020 UTC (4 years ago) by nicm
Branch: MAIN
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored)

Add a client flag 'active-pane' which stores the active pane in the
client and allows it to be changed independently from the real active
pane stored in the window. This is can be used with session groups which
allow an independent current window (although it would be nice to have a
flag for this too and remove session groups). The client active pane is
only really useful interactively, many things (hooks, window-style,
zooming) still use the window active pane.

Revision 1.95 / (download) - annotate - [select for diffs], Sat May 16 16:16:07 2020 UTC (4 years ago) by nicm
Branch: MAIN
Changes since 1.94: +2 -3 lines
Diff to previous 1.94 (colored)

Expand target from client and use it to expand the prompt.

Revision 1.94 / (download) - annotate - [select for diffs], Sat May 16 15:54:20 2020 UTC (4 years ago) by nicm
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

Support embedded styles in the display-message message, GitHub issue
2206.

Revision 1.93 / (download) - annotate - [select for diffs], Sat May 16 15:47:22 2020 UTC (4 years ago) by nicm
Branch: MAIN
Changes since 1.92: +26 -1 lines
Diff to previous 1.92 (colored)

Change message log to be per server rather than per client and include
every command that is run.

Revision 1.92 / (download) - annotate - [select for diffs], Sat May 16 15:40:04 2020 UTC (4 years ago) by nicm
Branch: MAIN
Changes since 1.91: +39 -2 lines
Diff to previous 1.91 (colored)

Add formats for after hook command arguments.

Revision 1.91 / (download) - annotate - [select for diffs], Thu Apr 23 05:48:42 2020 UTC (4 years ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.90: +7 -3 lines
Diff to previous 1.90 (colored)

Fix a couple of memory leaks, one when creating a new pane and one when
adding formats onto the queue item.

Revision 1.90 / (download) - annotate - [select for diffs], Tue Apr 14 06:00:52 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.89: +27 -11 lines
Diff to previous 1.89 (colored)

Provide an accessor for the running queue item and use it to not let
hooks recurse.

Revision 1.89 / (download) - annotate - [select for diffs], Mon Apr 13 20:51:57 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.88: +34 -5 lines
Diff to previous 1.88 (colored)

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.

Revision 1.88 / (download) - annotate - [select for diffs], Mon Apr 13 15:55:51 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.87: +108 -64 lines
Diff to previous 1.87 (colored)

When adding a list of commands to the queue, instead of automatically
creating a new state for each group of commands, require the caller to
create one and use it for all the commands in the list. This means the
current target works even with list with multiple groups (which can
happen if they are defined with newlines).

Revision 1.87 / (download) - annotate - [select for diffs], Mon Apr 13 14:46:04 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.86: +40 -10 lines
Diff to previous 1.86 (colored)

Move cmdq_state into cmd-queue.c.

Revision 1.86 / (download) - annotate - [select for diffs], Mon Apr 13 14:04:25 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.85: +32 -32 lines
Diff to previous 1.85 (colored)

Rename cmdq_shared to cmdq_state which will better reflect what it is
(going to be) used for.

Revision 1.85 / (download) - annotate - [select for diffs], Mon Apr 13 13:42:35 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.84: +6 -3 lines
Diff to previous 1.84 (colored)

Store a key event not a mouse event in the shared data.

Revision 1.84 / (download) - annotate - [select for diffs], Mon Apr 13 13:32:09 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.83: +9 -7 lines
Diff to previous 1.83 (colored)

Move the NOHOOKS flag into the shared flags.

Revision 1.83 / (download) - annotate - [select for diffs], Mon Apr 13 10:59:58 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.82: +113 -6 lines
Diff to previous 1.82 (colored)

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).

Revision 1.82 / (download) - annotate - [select for diffs], Mon Apr 13 08:26:27 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.81: +21 -14 lines
Diff to previous 1.81 (colored)

Make struct cmd local to cmd.c and move it out of tmux.h.

Revision 1.81 / (download) - annotate - [select for diffs], Fri Apr 10 07:44:26 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.80: +5 -3 lines
Diff to previous 1.80 (colored)

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.

Revision 1.80 / (download) - annotate - [select for diffs], Fri Apr 3 12:59:22 2020 UTC (4 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.79: +1 -9 lines
Diff to previous 1.79 (colored)

Stop logging the entire command queue every time we add something,
spotted by tb & sthen.

Revision 1.79 / (download) - annotate - [select for diffs], Sun Jan 5 12:51:43 2020 UTC (4 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.78: +5 -2 lines
Diff to previous 1.78 (colored)

Send errors to stdout in control mode so they don't get reordered with
other output, reported by George Nachman in GitHub issue 2048.

Revision 1.78 / (download) - annotate - [select for diffs], Thu Dec 19 09:22:33 2019 UTC (4 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.77: +17 -8 lines
Diff to previous 1.77 (colored)

When adding a list with multiple commands to the queue, the next item to
insert after needs to be the last one added, not the first. Reported by
Jason Kim in GitHub issue 2023.

Revision 1.77 / (download) - annotate - [select for diffs], Tue Dec 17 11:43:23 2019 UTC (4 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored)

Use the message that has already been built rather than the va_list.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Dec 12 11:39:56 2019 UTC (4 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.75: +15 -21 lines
Diff to previous 1.75 (colored)

Rewrite the code for reading and writing files. Now, if the client is
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.

Revision 1.75 / (download) - annotate - [select for diffs], Tue Sep 10 07:50:33 2019 UTC (4 years, 8 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.74: +1 -2 lines
Diff to previous 1.74 (colored)

Set up format tree for %if, GitHub issue 1896.

Revision 1.74 / (download) - annotate - [select for diffs], Tue Jun 18 11:08:42 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.73: +8 -1 lines
Diff to previous 1.73 (colored)

Add a cmdq_continue function rather than twiddling the flag directly.

Revision 1.73 / (download) - annotate - [select for diffs], Fri May 31 21:41:17 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

Fix warnings, from Ben Boeckel.

Revision 1.72 / (download) - annotate - [select for diffs], Wed May 29 19:34:42 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.71: +21 -9 lines
Diff to previous 1.71 (colored)

The line number needs to be updated only after the \n is processed by
the parser, so store a flag and update it next time around. Also each
new line needs its own shared data.

Revision 1.71 / (download) - annotate - [select for diffs], Sat May 25 10:46:55 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.70: +5 -2 lines
Diff to previous 1.70 (colored)

Client name can actually be NULL, so use address in that case.

Revision 1.70 / (download) - annotate - [select for diffs], Sat May 25 10:44:09 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.69: +3 -3 lines
Diff to previous 1.69 (colored)

Use client name when logging command queue.

Revision 1.69 / (download) - annotate - [select for diffs], Thu May 23 13:08:43 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.68: +3 -1 lines
Diff to previous 1.68 (colored)

Don't remove group items for group 0 (no group).

Revision 1.68 / (download) - annotate - [select for diffs], Thu May 23 11:13:30 2019 UTC (4 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.67: +4 -12 lines
Diff to previous 1.67 (colored)

Replace the split parser code (cfg.c and cmd-string.c) with a single
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.

Revision 1.67 / (download) - annotate - [select for diffs], Mon May 20 11:46:06 2019 UTC (5 years ago) by nicm
Branch: MAIN
Changes since 1.66: +20 -1 lines
Diff to previous 1.66 (colored)

Replace the various identical error callbacks with a single one in cmd-queue.c.

Revision 1.66 / (download) - annotate - [select for diffs], Sat May 18 21:14:10 2019 UTC (5 years ago) by nicm
Branch: MAIN
Changes since 1.65: +3 -2 lines
Diff to previous 1.65 (colored)

Move the single command flag (CMD_CONTROL) into the shared flags.

Revision 1.65 / (download) - annotate - [select for diffs], Fri May 3 18:59:58 2019 UTC (5 years ago) by nicm
Branch: MAIN
Changes since 1.64: +2 -1 lines
Diff to previous 1.64 (colored)

Insert after the right element on queue.

Revision 1.64 / (download) - annotate - [select for diffs], Fri May 3 15:43:01 2019 UTC (5 years ago) by nicm
Branch: MAIN
Changes since 1.63: +10 -16 lines
Diff to previous 1.63 (colored)

Correct ordering when adding after an existing item.

Revision 1.63 / (download) - annotate - [select for diffs], Fri Apr 26 11:38:51 2019 UTC (5 years ago) by nicm
Branch: MAIN
Changes since 1.62: +56 -2 lines
Diff to previous 1.62 (colored)

Merge hooks into options and make each one an array option. This allows
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).

Revision 1.62 / (download) - annotate - [select for diffs], Wed Apr 17 14:37:48 2019 UTC (5 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.61: +2 -2 lines
Diff to previous 1.61 (colored)

Break new window and pane creation common code from various commands and
window.c into a separate file spawn.c.

Revision 1.61 / (download) - annotate - [select for diffs], Tue Mar 12 11:16:50 2019 UTC (5 years, 2 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.60: +8 -8 lines
Diff to previous 1.60 (colored)

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.

Revision 1.60 / (download) - annotate - [select for diffs], Fri Mar 8 10:34:20 2019 UTC (5 years, 2 months ago) by nicm
Branch: MAIN
Changes since 1.59: +11 -8 lines
Diff to previous 1.59 (colored)

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.

Revision 1.59 / (download) - annotate - [select for diffs], Thu Mar 7 19:34:22 2019 UTC (5 years, 2 months ago) by nicm
Branch: MAIN
Changes since 1.58: +2 -7 lines
Diff to previous 1.58 (colored)

Tidy changing the mode into window_copy_init_for_output.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Aug 30 10:33:57 2017 UTC (6 years, 8 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.57: +2 -2 lines
Diff to previous 1.57 (colored)

Pass flags into cmd_find_from_* to fix prefer-unattached, reported by
Thomas Sattler.

Revision 1.57 / (download) - annotate - [select for diffs], Fri Jun 16 15:12:38 2017 UTC (6 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.56: +3 -1 lines
Diff to previous 1.56 (colored)

Tweak some logging.

Revision 1.56 / (download) - annotate - [select for diffs], Tue May 30 21:44:59 2017 UTC (6 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.55: +3 -2 lines
Diff to previous 1.55 (colored)

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.

Revision 1.55 / (download) - annotate - [select for diffs], Mon May 1 12:20:55 2017 UTC (7 years ago) by nicm
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

In order that people can use formats like #D in #() in the status line
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.

Revision 1.54 / (download) - annotate - [select for diffs], Sat Apr 22 10:22:39 2017 UTC (7 years ago) by nicm
Branch: MAIN
Changes since 1.53: +32 -12 lines
Diff to previous 1.53 (colored)

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.

Revision 1.53 / (download) - annotate - [select for diffs], Fri Apr 21 22:23:24 2017 UTC (7 years ago) by nicm
Branch: MAIN
Changes since 1.52: +4 -4 lines
Diff to previous 1.52 (colored)

Log error properly when no current state, and some other minor tweaks.

Revision 1.52 / (download) - annotate - [select for diffs], Fri Apr 21 20:34:05 2017 UTC (7 years ago) by nicm
Branch: MAIN
Changes since 1.51: +4 -1 lines
Diff to previous 1.51 (colored)

Clear shared state if not filling it in.

Revision 1.51 / (download) - annotate - [select for diffs], Fri Apr 21 20:26:34 2017 UTC (7 years ago) by nicm
Branch: MAIN
Changes since 1.50: +6 -5 lines
Diff to previous 1.50 (colored)

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.

Revision 1.50 / (download) - annotate - [select for diffs], Fri Apr 21 18:18:17 2017 UTC (7 years ago) by nicm
Branch: MAIN
Changes since 1.49: +3 -4 lines
Diff to previous 1.49 (colored)

Style nits and an unused struct.

Revision 1.49 / (download) - annotate - [select for diffs], Fri Apr 21 14:01:19 2017 UTC (7 years ago) by nicm
Branch: MAIN
Changes since 1.48: +19 -13 lines
Diff to previous 1.48 (colored)

Store state shared between multiple commands in the queue in a shared
structure.

Revision 1.48 / (download) - annotate - [select for diffs], Fri Feb 3 11:57:27 2017 UTC (7 years, 3 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)

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.

Revision 1.47 / (download) - annotate - [select for diffs], Thu Jan 5 09:07:15 2017 UTC (7 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.46: +1 -2 lines
Diff to previous 1.46 (colored)

Highlight all occurrences of search string after searching in copy mode.

Revision 1.46 / (download) - annotate - [select for diffs], Tue Oct 18 08:46:43 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.45: +16 -4 lines
Diff to previous 1.45 (colored)

Give each item on queue a name for better logging.

Revision 1.45 / (download) - annotate - [select for diffs], Sun Oct 16 19:36:37 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.44: +25 -2 lines
Diff to previous 1.44 (colored)

Provide a way for hooks to tag formats onto the commands they fire so
that the user can get at additional information - now used for the
"hook" format, more to come.

Revision 1.44 / (download) - annotate - [select for diffs], Sun Oct 16 19:04:05 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.43: +106 -106 lines
Diff to previous 1.43 (colored)

Mass rename struct cmd_q to struct cmdq_item and related.

Revision 1.43 / (download) - annotate - [select for diffs], Sun Oct 16 17:55:14 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.42: +296 -199 lines
Diff to previous 1.42 (colored)

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.

Revision 1.42 / (download) - annotate - [select for diffs], Sat Oct 15 00:01:01 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.41: +2 -6 lines
Diff to previous 1.41 (colored)

Drain notifys once at the end of the server loop instead of doing it
from the end of every command queue (which could be nested).

Revision 1.41 / (download) - annotate - [select for diffs], Fri Oct 14 18:41:53 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.40: +10 -3 lines
Diff to previous 1.40 (colored)

source-file and some other commands can recurse back into cmdq_continue,
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.

Revision 1.40 / (download) - annotate - [select for diffs], Thu Oct 13 22:48:51 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.39: +27 -63 lines
Diff to previous 1.39 (colored)

Trying to do hooks generically is way too complicated and unreliable and
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.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Oct 13 10:01:49 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.38: +29 -17 lines
Diff to previous 1.38 (colored)

Some improvements and bug fixes for hooks:

- 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.

Revision 1.38 / (download) - annotate - [select for diffs], Tue Oct 11 13:21:59 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.37: +3 -2 lines
Diff to previous 1.37 (colored)

Add static in window-*.c and move some internal functions out of tmux.h.

Revision 1.37 / (download) - annotate - [select for diffs], Wed Sep 28 14:40:07 2016 UTC (7 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

Couple of vasprintf -> xvasprintf.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Apr 29 14:05:24 2016 UTC (8 years ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.35: +50 -8 lines
Diff to previous 1.35 (colored)

Final parts of command hooks, add before- and after- hooks to each command.

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jan 19 16:01:30 2016 UTC (8 years, 4 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

Split out getting the current state from the target search so it can be
replaced if we already know the current.

Revision 1.34 / (download) - annotate - [select for diffs], Tue Jan 19 15:59:12 2016 UTC (8 years, 4 months ago) by nicm
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

I no longer use my SourceForge address so replace it.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Dec 16 21:50:37 2015 UTC (8 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.32: +5 -1 lines
Diff to previous 1.32 (colored)

Add infrastructure to work out the best target given a pane or window
alone and use it to add pane_died and pane_exited hooks.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Dec 13 16:11:42 2015 UTC (8 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.31: +3 -1 lines
Diff to previous 1.31 (colored)

If command returns error, report it.

Revision 1.31 / (download) - annotate - [select for diffs], Sun Dec 13 14:32:38 2015 UTC (8 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.30: +15 -12 lines
Diff to previous 1.30 (colored)

Instead of every command resolving the target (-t or -s) itself, prepare
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.

Revision 1.30 / (download) - annotate - [select for diffs], Fri Nov 27 15:06:43 2015 UTC (8 years, 5 months ago) by nicm
Branch: MAIN
Changes since 1.29: +5 -4 lines
Diff to previous 1.29 (colored)

Do not set a limit on the length of commands when printing them.

Revision 1.29 / (download) - annotate - [select for diffs], Sat Nov 14 09:41:06 2015 UTC (8 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.28: +4 -4 lines
Diff to previous 1.28 (colored)

Push stdout and stderr to clients more aggressively, and add an event to
continue if the send fails.

Revision 1.28 / (download) - annotate - [select for diffs], Thu Nov 12 11:10:50 2015 UTC (8 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.27: +17 -4 lines
Diff to previous 1.27 (colored)

If we know the terminal outside tmux is not UTF-8, replace UTF-8 in
error messages and whatnot with underscores the same as we do when we
draw UTF-8 characters as part of the screen.

Revision 1.27 / (download) - annotate - [select for diffs], Tue Oct 20 21:12:08 2015 UTC (8 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

Use client pointer not file descriptor in logging.

Revision 1.26 / (download) - annotate - [select for diffs], Wed Sep 16 22:41:00 2015 UTC (8 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.25: +5 -1 lines
Diff to previous 1.25 (colored)

Log when cmdq_continue is called.

Revision 1.25 / (download) - annotate - [select for diffs], Wed Sep 16 22:24:54 2015 UTC (8 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.24: +7 -4 lines
Diff to previous 1.24 (colored)

Rename cmd_q dead flag to a general flags bitmask (will be more flags later).

Revision 1.24 / (download) - annotate - [select for diffs], Wed Jun 17 17:02:15 2015 UTC (8 years, 11 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.23: +31 -21 lines
Diff to previous 1.23 (colored)

Break cmdq_continue inner loop into a helper function.

Revision 1.23 / (download) - annotate - [select for diffs], Sun Apr 19 21:34:21 2015 UTC (9 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.22: +10 -4 lines
Diff to previous 1.22 (colored)

Rewrite of tmux mouse support which was a mess. Instead of having
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.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Feb 12 09:56:19 2015 UTC (9 years, 3 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.21: +5 -2 lines
Diff to previous 1.21 (colored)

Take a reference to prevent cmdq being freed during the command. Can
happen to cfg_cmd_q (possibly others) when source-file recurses into
cmdq_continue. Fixes bug reported by Ismail Donmez and Theo Buehler.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Feb 5 10:26:29 2015 UTC (9 years, 3 months ago) by nicm
Branch: MAIN
Changes since 1.20: +10 -15 lines
Diff to previous 1.20 (colored)

There is no need to save the guard state because the function checks it
again anyway.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Oct 27 22:23:47 2014 UTC (9 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.19: +5 -6 lines
Diff to previous 1.19 (colored)

Move cfg_causes local into cfg.c and remove struct causelist.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Oct 21 22:06:46 2014 UTC (9 years, 6 months ago) by nicm
Branch: MAIN
Changes since 1.18: +2 -3 lines
Diff to previous 1.18 (colored)

Save next item after firing command in case it has added to the queue.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Oct 20 23:57:13 2014 UTC (9 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

Better format for printf format attributes.

Revision 1.17 / (download) - annotate - [select for diffs], Mon Sep 1 21:50:18 2014 UTC (9 years, 8 months ago) by nicm
Branch: MAIN
Changes since 1.16: +4 -4 lines
Diff to previous 1.16 (colored)

Various minor style and spacing nits.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Apr 17 07:55:43 2014 UTC (10 years, 1 month ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.15: +1 -32 lines
Diff to previous 1.15 (colored)

Remove the "info" message mechanism, this was only used for about five
mostly useless and annoying messages. Change those commands to silence
on success like all the others. Still accept the -q command line flag
and "quiet" server option for now.

Revision 1.15 / (download) - annotate - [select for diffs], Thu Jan 9 13:46:12 2014 UTC (10 years, 4 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.14: +1 -5 lines
Diff to previous 1.14 (colored)

Remove unnecessary calls to va_start/va_end, from Tiago Cunha.

Revision 1.14 / (download) - annotate - [select for diffs], Thu Oct 10 12:26:35 2013 UTC (10 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.13: +1 -25 lines
Diff to previous 1.13 (colored)

Alter how tmux handles the working directory to internally use file
descriptors rather than strings.

- Each session still has a current working directory.

- New sessions still get their working directory from the client that
  created them or its attached session if any.

- New windows are created by default in the session working directory.

- The -c flag to new, neww, splitw allows the working directory to be
  overridden.

- The -c flag to attach let's the session working directory be changed.

- The default-path option has been removed.

To get the equivalent to default-path '.', do:

        bind c neww -c $PWD

To get the equivalent of default-path '~', do:

        bind c neww -c ~

This also changes the client identify protocol to be a set of messages rather
than one as well as some other changes that should make it easier to make
backwards-compatible protocol changes in future.

Revision 1.13 / (download) - annotate - [select for diffs], Thu Oct 10 12:12:54 2013 UTC (10 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

retcode -> retval for exit message.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Oct 10 12:07:36 2013 UTC (10 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.11: +25 -1 lines
Diff to previous 1.11 (colored)

Support -c for new-session, based on code from J Raynor.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Oct 10 12:04:38 2013 UTC (10 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

Make cmdq->client_exit a tristate (-1 means "not set") so that if
explicitly set it can be copied from child to parent cmdq by if-shell
and source-file. This fixes using attach or new. From Chris Johnsen.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Oct 10 11:45:28 2013 UTC (10 years, 7 months ago) by nicm
Branch: MAIN
Changes since 1.9: +9 -9 lines
Diff to previous 1.9 (colored)

Pass flags into cmdq_guard as an argument since sometimes cmdq->cmd can
be NULL. Avoids crash when a command in a command client can't be
parsed.

Revision 1.9 / (download) - annotate - [select for diffs], Sun Jun 23 12:41:54 2013 UTC (10 years, 10 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.8: +6 -3 lines
Diff to previous 1.8 (colored)

Mark control commands specially so the client can identify them, based
on a diff from George Nachman a while back.

Revision 1.8 / (download) - annotate - [select for diffs], Wed Apr 10 12:15:36 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

Fix bug where end guard in control mode was not printed after session
destroyed, from George Nachman.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Mar 26 10:54:48 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.6: +2 -1 lines
Diff to previous 1.6 (colored)

Fix compiler warnings, missing #include. From Thomas Adam.

Revision 1.6 / (download) - annotate - [select for diffs], Mon Mar 25 11:41:16 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.5: +13 -10 lines
Diff to previous 1.5 (colored)

Only send end guard if begin was sent, from George Nachman.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Mar 25 11:36:08 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

Fix a warning.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Mar 25 11:35:55 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.3: +26 -15 lines
Diff to previous 1.3 (colored)

Add time and a command count to control mode guards, based on code from
George Nachman.

Revision 1.3 / (download) - annotate - [select for diffs], Mon Mar 25 10:06:13 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.2: +6 -1 lines
Diff to previous 1.2 (colored)

Add some additional debug logging.

Revision 1.2 / (download) - annotate - [select for diffs], Mon Mar 25 10:05:00 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.1: +7 -3 lines
Diff to previous 1.1 (colored)

Print %%error not %%end guard on error, from George Nachman.

Revision 1.1 / (download) - annotate - [select for diffs], Sun Mar 24 09:54:10 2013 UTC (11 years, 1 month ago) by nicm
Branch: MAIN

Add a command queue to standardize and simplify commands that call other
commands and allow a command to block execution of subsequent
commands. This allows run-shell and if-shell to be synchronous which has
been much requested.

Each client has a default command queue and commands are consumed one at
a time from it. A command may suspend execution from the queue by
returning CMD_RETURN_WAIT and then resume it by calling cmd_continue() -
for example run-shell does this from the callback that is fired after
the job is freed.

When the command queue becomes empty, command clients are automatically
exited (unless attaching). A callback is also fired - this is used for
nested commands in, for example, if-shell which can block execution of
the client's cmdq until a new cmdq becomes empty.

Also merge all the old error/info/print functions together and lose the
old curclient/cmdclient distinction - a cmdq is bound to one client (or
none if in the configuration file), this is a command client if
c->session is NULL otherwise an attached client.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.