Commit Graph

307 Commits

Author SHA1 Message Date
nicm 8bd29a30bf Make synchronize-panes a pane option and add -U flag to set-option to
unset an option on all panes. GitHub issue 2491 from Rostislav Nesin.
2020-12-15 08:31:50 +00:00
nicm 9a74bba007 Make replacement of ##s consistent when drawing formats, whether
followed by [ or not. Add a flag (e) to the q: format modifier to double
up #s and use it for the window_flags format variable so it doesn't end
up escaping any following text. GitHub issue 2485.
2020-12-01 08:12:58 +00:00
nicm 61e55fa50d Change how escaping is processed for formats so that ## and # can be
used in styles. Also add a 'w' format modifier for the width. From Chas
J Owens IV in GitHub issue 2389.
2020-11-09 09:10:10 +00:00
nicm ac5045a00f Add numeric comparisons for formats, from teo_paul1 at yahoo dot com in
GitHub issue 2442.
2020-11-02 08:21:30 +00:00
nicm 7e319756d2 Fix a last minute change in previous. 2020-10-06 07:36:42 +00:00
nicm e369f64669 Add a state struct to store working state during format expansion
instead of modiyfing the format tree.

Use this to disable nested job expansion so that the result of #() is
not expanded again. Reported by Chas J Owens IV, GitHub issue 2390.
2020-10-06 07:36:05 +00:00
nicm 869c0e860f Fix some warnings, GitHub issue 2382. 2020-09-16 18:37:55 +00:00
nicm 2ab289980a Add pane_last format, GitHub issue 2353. 2020-08-27 06:55:54 +00:00
nicm d0957529ed Add n: modifier to get length of a format, also automatically expand
variable name arguments again if they contain a #{.
2020-08-20 16:57:40 +00:00
nicm 2964dde903 Use xvasprintf not vasprintf. 2020-06-23 05:23:26 +00:00
nicm 63c2ed1483 Add some formats for search in copy mode (search_present, search_match).
GitHub issue 2268.
2020-06-11 19:43:34 +00:00
nicm 9819470058 Change format callback to return value rather than storing it in the entry. 2020-06-01 19:39:25 +00:00
nicm bbfb44e9b2 Make some data types consistent. 2020-05-25 15:02:25 +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 daa95810b5 Allow a custom time format to be given to the t format modifier. 2020-05-16 15:48:35 +00:00
nicm 367b4e4e0f Change message log to be per server rather than per client and include
every command that is run.
2020-05-16 15:47:22 +00:00
nicm cf9baddd6f Change the existing client flags for control mode to apply for any
client, use the same mechanism for the read-only flag and add an
ignore-size flag.

refresh-client -F has become -f (-F stays for backwards compatibility)
and attach-session and switch-client now have -f flags also. A new
format "client_flags" lists the flags and is shown by list-clients by
default.

This separates the read-only flag from "ignore size" behaviour (new
ignore-size) flag - both behaviours are useful in different
circumstances.

attach -r and switchc -r remain and set or toggle both flags together.
2020-05-16 15:45:29 +00:00
nicm 0487029fc5 Call format_defaults_window for panes as well. 2020-05-16 14:55:38 +00:00
nicm 0dd1944206 Tweak the default choose modes formats:
- Only show pane title if it is not default and not empty.
- Add a prettier time format and use that instead of long ctime().
- Remove clutter and change the order.
2020-05-16 14:10:29 +00:00
nicm 662728d6c7 Add a session_marked format like window_marked. 2020-04-22 20:47:00 +00:00
nicm c91b4b2e14 Tidy up the terminal detection and feature code and add named sets of
terminal features, each of which are defined in one place and map to a
builtin set of terminfo(5) capabilities. Features can be specified based
on TERM with a new terminal-features option or with the -T flag when
running tmux. tmux will also detect a few common terminals from the DA
and DSR responses.

This is intended to make it easier to configure tmux's use of
terminfo(5) even in the presence of outdated ncurses(3) or terminfo(5)
databases or for features which do not yet have a terminfo(5) entry.
Instead of having to grok terminfo(5) capability names and what they
should be set to in the terminal-overrides option, the user can
hopefully just give tmux a feature name and let it do the right thing.

The terminal-overrides option remains both for backwards compatibility
and to allow tweaks of individual capabilities.

tmux already did much of this already, this makes it tidier and simpler
to configure.
2020-04-20 13:25:36 +00:00
nicm 4a93294152 Use size_t not u_int for the bytes counters and fix a const missing. 2020-04-18 14:21:39 +00:00
nicm c87595326c Use peek line function instead of hoking in the array directly. 2020-04-18 09:00:31 +00:00
nicm e153b928ff Add formats for pane written/skipped bytes for debugging. 2020-04-18 07:19:28 +00:00
nicm 5ec80bd249 Move the UTF-8 flag to terminal flags. 2020-04-16 14:25:35 +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 adb76fd1ce Move cmdq_state into cmd-queue.c. 2020-04-13 14:46:04 +00:00
nicm 9a65102bfc Rename cmdq_shared to cmdq_state which will better reflect what it is
(going to be) used for.
2020-04-13 14:04:25 +00:00
nicm 77d5b0cc53 Store a key event not a mouse event in the shared data. 2020-04-13 13:42:35 +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 a1fc8f8b23 More style nits. 2020-04-09 15:35:27 +00:00
nicm 315961faec Some more, and use of wp->window before wp NULL check in format.c. 2020-04-09 13:53:50 +00:00
nicm 5d0eb619f1 Restore pane_current_path format from portable tmux, it is no longer
used by default and is very useful.
2020-04-08 11:26:07 +00:00
nicm 2a4714e76b Add session_path from Chris Ruegge in GitHub issue 2142. 2020-03-31 11:58:05 +00:00
nicm 3bbd66c013 Move alternate screen into the screen rather than the pane. 2020-03-31 07:00:34 +00:00
nicm e0b17e796b Add formats for top paste buffer by default. Also a tmux.1 fix from jmc. 2020-03-28 09:39:27 +00:00
nicm 1a4e64ba69 Apply same menu items to view mode like copy mode. 2020-03-20 18:35:53 +00:00
nicm 06c3079d66 Make the mouse_word and mouse_line formats work in copy mode and enable
the default pane menu in copy mode.
2020-03-20 17:59:39 +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 c820585dd0 Add some number operators for formats, from Tyler Culp. 2020-03-11 14:17:55 +00:00
nicm 58b47bf01b Fix top/bottom pane calculation with pane border status enabled,
reported by Stanislav Spassov.
2020-02-14 13:57:58 +00:00
nicm f165221dc4 Reduce a difference with portable tmux by adding the -V flag and
#{version} format; on OpenBSD these just report the OpenBSD version.
2020-01-28 10:44:30 +00:00
nicm 193e637de0 The terminal type was never as much use as I expected so remove it in
favour of a couple of flags for the features used (DECSLRM and DECFRA).
Also rename the flag for no xenl to be more obvious while here.
2020-01-12 21:07:07 +00:00
nicm 88ee5b1a73 Pass correct value into iterator callback for time formats. 2019-12-26 14:48:29 +00:00
nicm 817d199cbb Add a number of new formats to inspect what sessions and clients a
window is present or active in. From Tyler Culp in GitHub issue 2034.
2019-12-26 11:04:58 +00:00
nicm c5d74b1deb Do not crash when a format doesn't exist, reported by Thomas Sattler. 2019-11-28 21:18:38 +00:00
nicm 2349b1dbef Make a best effort to set xpixel and ypixel for each pane and add
formats for them.
2019-11-28 09:45:15 +00:00
nicm 067604bf8c Store xpixel/ypixel from TIOCGWINSZ and add formats. 2019-11-28 09:05:34 +00:00
nicm 1ebd8c1234 Add p format modifier for padding to width. 2019-11-25 15:04:15 +00:00
nicm 5d0504ee11 Allow multiple substitutions in a single format. 2019-11-25 15:02:48 +00:00
nicm 5dfe9db788 Do not add path if it is NULL, duh. 2019-11-15 11:21:32 +00:00
nicm f3dc38dcae Handle OSC 7 (a VTE extension) and put the result in a new format (pane_path). 2019-11-15 11:16:53 +00:00
nicm f7fb5df543 Use the existing code in format.c to add foramts for word and line at
cursor position in copy mode, from Anindya Mukherjee.
2019-10-23 07:42:05 +00:00
nicm b598bbcc2e Do not crash with pane_current_command if the pane is newly created and
has no shell set, from Thomas Adam.
2019-10-14 09:24:06 +00:00
nicm 48c684cbc2 Mouse formats don't work in copy mode so don't try to use them. 2019-09-24 14:50:08 +00:00
nicm a23ce1b45f Add window_marked_flag, GitHub issue 1887. 2019-09-11 06:43:17 +00:00
nicm 4b7e97ba53 Set up format tree for %if, GitHub issue 1896. 2019-09-10 07:50:33 +00:00
nicm fc2016dbb6 Add a -H flag to send-keys to send literal keys given as hex numbers
(needed for control clients to send mouse sequences). Also add some
format flags for UTF-8 and SGR mouse mode. Requested by Bradley Smith in
GitHub issues 1832 and 1833.
2019-07-09 14:03:12 +00:00
nicm 20b938bcb1 Expand arguments to C and s format modifiers (matches m which already expands). 2019-06-24 10:04:29 +00:00
nicm 5f92f92908 Add a per-pane option set. Pane options inherit from window options (so
there should be no change to existing behaviour) and are set and shown
with set-option -p and show-options -p.

Change remain-on-exit and window-style/window-active-style to be pane
options (some others will be changed later).

This makes select-pane -P and -g unnecessary so no longer document them
(they still work) and no longer document set-window-option and
show-window-options in favour of set-option -w and show-options -w.
2019-06-20 11:59:59 +00:00
nicm ae541287d3 Expand command formats in %if and move the config file loading later (to
when the first client has identified) so all the client formats are
available, fixes problems reported by Thomas Sattler.
2019-06-20 06:51:36 +00:00
nicm 03da0ced46 Use the right format modifier when comparing, and remove a couple of
unused variables.
2019-06-15 06:33:48 +00:00
nicm eef11b64e1 Do not crash if the environment variable is present but empty. 2019-06-13 21:24:09 +00:00
nicm 3e72e98e3b Add regular expression support for the format search, match and
substitute modifiers.
2019-06-13 19:46:00 +00:00
nicm 2c5f3074bc Fix warnings, from Ben Boeckel. 2019-05-31 21:41:17 +00:00
nicm 799a154b91 Change display-menu from taking a single string to a set of arguments,
which is much easier to work with. Based on a diff from Avi Halachmi.
2019-05-28 07:18:42 +00:00
nicm 94f6488f0e Go less crazy with horizontal separators on default menus. 2019-05-27 15:29:46 +00:00
nicm 097973e3d5 Add keys for new menu items. 2019-05-26 18:43:43 +00:00
nicm e90d4a6021 Add formats for word and line under the mouse and use them to add some
items to the pane menu.
2019-05-26 17:34:45 +00:00
nicm 6431005169 Add a way to append or prepend to a format if the length has been limited. 2019-05-26 12:02:42 +00:00
nicm a65a6d62d1 Add <, >, <=, >= for formats, GitHub issue 1747. 2019-05-25 16:51:10 +00:00
nicm 1b0512aa7e Always include Lock in the menu. 2019-05-13 20:07:02 +00:00
nicm d62fd78655 Fix a typo in previous (, -> :). 2019-05-10 18:09:51 +00:00
nicm 6dcca5fda4 Add support for simple menus usable with mouse or keyboard. New command
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-10 18:04:06 +00:00
nicm 299b7289ea Add formats to show if pane is the marked pane and if any marked pane is set. 2019-05-09 08:38:13 +00:00
nicm 9f75635596 Allow panes to be empty (no command), output can be piped to them with
split-window or display-message -I.
2019-05-03 20:44:24 +00:00
nicm 32a81e197b Make options_tostring allocate its result instead of using a stack
buffer (needed for something in the future).
2019-04-25 18:18:55 +00:00
nicm d68a17a1df Free old strings after they have been expanded in format_choose. 2019-03-29 09:33:24 +00:00
nicm 08bc226527 Expand session and window formats for buffer filters. 2019-03-28 21:05:15 +00:00
nicm 161b57869e Add a cursor_character format. 2019-03-19 19:01:50 +00:00
nicm 979313832c Extend the #[] style syntax and use that together with previous format
changes to allow the status line to be entirely configured with a single
option.

Now that it is possible to configure their content, enable the existing
code that lets the status line be multiple lines in height. The status
option can now take a value of 2, 3, 4 or 5 (as well as the previous on
or off) to configure more than one line. The new status-format array
option configures the format of each line, the default just references
the existing status-* options, although some of the more obscure status
options may be eliminated in time.

Additions to the #[] syntax are: "align" to specify alignment (left,
centre, right), "list" for the window list and "range" to configure
ranges of text for the mouse bindings.

The "align" keyword can also be used to specify alignment of entries in
tree mode and the pane status lines.
2019-03-18 20:53:33 +00:00
nicm 2628af573d Add format variables for the default formats for the various modes
(tree_mode_format and so on) and add a -a flag to display-message to
list variables with values.
2019-03-18 14:10:25 +00:00
nicm d2d43987d0 With force, kill previous job before starting new. Fixes problem
reported by Scott Mcdermott in GitHub issue 1627.
2019-03-18 09:46:42 +00:00
nicm 33595a255f Copy recursion counter into new formats when looping. 2019-03-15 15:02:25 +00:00
nicm f6d34f066c Only print format logging when the flag is set, even if also sending to log_debug. 2019-03-15 10:22:57 +00:00
nicm 672c49d512 The pane and window loops need to pass the window and pane tags when
they build their format.
2019-03-15 10:07:24 +00:00
nicm 27578815da Add a -v flag to display-message to show verbose messages as the format
is parsed, this gives the user a way to debug problems with formats
rather than just being confronted with (for example) a blank status
line.
2019-03-15 10:04:13 +00:00
nicm 25e2e22791 Add a limit on how far format_expand can recurse. 2019-03-14 23:34:41 +00:00
nicm 10d60faba5 Store the time in the format tree rather than passing it around. 2019-03-14 23:14:27 +00:00
nicm 4206bcc10e Add format flags for start and end window. 2019-03-14 21:41:30 +00:00
nicm 38064e7593 Add T format modifier like E but also do strftime(3). 2019-03-14 21:31:43 +00:00
nicm 1416ceb575 Accept 0 time as a shorthand for now to format_expand_time. 2019-03-14 21:27:26 +00:00
nicm 6dffbc4849 Tweak format_replace logging. 2019-03-13 18:09:12 +00:00
nicm 95ab1aaaec Add formats to list sessions, windows or panes. 2019-03-13 15:37:28 +00:00
nicm 49f04a997a Apply length limits and substitution even to literal formats. 2019-03-13 14:27:17 +00:00
nicm 9032ac2a05 Add E: format to expand a format twice (useful to expand the value of an
option).
2019-03-13 14:19:54 +00:00
nicm 71e00c718c Make format parsing build the modifiers into a list, standardize how
arguments are given and allow multiple modifiers on a format (separated
by ;).
2019-03-13 14:10:34 +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 f98c66ece8 Add a separate mode struct for the active window mode if any. 2019-03-07 20:24:21 +00:00