Commit Graph

563 Commits (1b28b2b51d264544a7c9490087561c9192459ba5)

Author SHA1 Message Date
nicm 58b47bf01b Fix top/bottom pane calculation with pane border status enabled,
reported by Stanislav Spassov.
2020-02-14 13:57:58 +00:00
Thomas Adam ee3d3db364 Merge branch 'obsd-master' 2020-01-28 11:17:08 +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
Thomas Adam e9b1294331 Merge branch 'obsd-master' 2020-01-12 22:01:26 +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
Thomas Adam 0aa6c6f647 Merge branch 'obsd-master' 2019-12-26 16:01:25 +00:00
nicm 88ee5b1a73 Pass correct value into iterator callback for time formats. 2019-12-26 14:48:29 +00:00
Thomas Adam b931bbb319 Merge branch 'obsd-master' 2019-12-26 12:01:26 +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
Thomas Adam 34084fe666 Merge branch 'obsd-master' 2019-11-28 22:01:24 +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
Thomas Adam 5f5f029e3b Merge branch 'obsd-master' 2019-11-28 12:18:41 +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
Thomas Adam daa93b3fdc Merge branch 'obsd-master' 2019-11-25 16:01:27 +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
Thomas Adam dbdff241b2 Merge branch 'obsd-master' 2019-11-15 12:01:27 +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
Thomas Adam b5de0a20d8 Merge branch 'obsd-master' 2019-10-23 10:01:27 +01: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
Thomas Adam eb57cbcc29 Merge branch 'obsd-master' 2019-10-14 12:01:26 +01: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
Thomas Adam 2534aa4d2d Merge branch 'obsd-master' 2019-09-24 18:01:24 +01: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
Thomas Adam a5e36a4bd6 Merge branch 'obsd-master' 2019-09-13 04:01:25 +01:00
Thomas Adam 658ecb0777 Merge branch 'obsd-master' 2019-09-11 16:48:58 +01: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
Thomas Adam 98ef369b27 Merge branch 'obsd-master' 2019-07-09 17:02:26 +01: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
Thomas Adam a1d4bf20f7 Merge branch 'obsd-master' 2019-06-24 13:02:26 +01:00
nicm 20b938bcb1 Expand arguments to C and s format modifiers (matches m which already expands). 2019-06-24 10:04:29 +00:00
Thomas Adam f8ad72b2ee Merge branch 'obsd-master' 2019-06-20 15:02:26 +01: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
Thomas Adam 03945276f7 Merge branch 'obsd-master' 2019-06-20 09:02:26 +01: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
Thomas Adam 5895f1d9f7 Merge branch 'obsd-master' 2019-06-15 09:02:26 +01: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
Thomas Adam 5e9757b30b Merge branch 'obsd-master' 2019-06-14 15:51:09 +01: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
Thomas Adam 480cdedcac Merge branch 'obsd-master' 2019-06-01 01:02:25 +01:00
nicm 2c5f3074bc Fix warnings, from Ben Boeckel. 2019-05-31 21:41:17 +00:00
Thomas Adam c0116b2c5b Merge branch 'obsd-master' 2019-05-28 09:02:26 +01: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
Thomas Adam 793f4d89d6 Merge branch 'obsd-master' 2019-05-27 19:02:25 +01:00
nicm 94f6488f0e Go less crazy with horizontal separators on default menus. 2019-05-27 15:29:46 +00:00
Thomas Adam 103e44d936 Merge branch 'obsd-master' 2019-05-26 21:02:26 +01: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
Thomas Adam 2e84d1cf03 Merge branch 'obsd-master' 2019-05-26 15:02:25 +01: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
Thomas Adam 463bd8abb9 Merge branch 'obsd-master' 2019-05-25 18:41:51 +01:00
nicm a65a6d62d1 Add <, >, <=, >= for formats, GitHub issue 1747. 2019-05-25 16:51:10 +00:00
Thomas Adam 1eefbd28e8 Merge branch 'obsd-master' 2019-05-13 23:02:26 +01:00
nicm 1b0512aa7e Always include Lock in the menu. 2019-05-13 20:07:02 +00:00
Thomas Adam aa13bd4016 Merge branch 'obsd-master' 2019-05-10 22:10:38 +01: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
Thomas Adam f431e20f3d Merge branch 'obsd-master' 2019-05-09 11:02:25 +01: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
Thomas Adam d4177e954c Merge branch 'obsd-master' 2019-05-03 23:02:28 +01: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
Thomas Adam 7c4a2253e8 Merge branch 'obsd-master' 2019-04-25 21:02:43 +01: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
Thomas Adam ecc5cea09b Merge branch 'obsd-master' 2019-03-29 10:02:36 +00:00
nicm d68a17a1df Free old strings after they have been expanded in format_choose. 2019-03-29 09:33:24 +00:00
Thomas Adam 2c4f2393ec Merge branch 'obsd-master' 2019-03-28 22:02:37 +00:00
nicm 08bc226527 Expand session and window formats for buffer filters. 2019-03-28 21:05:15 +00:00
Thomas Adam 320237fdb8 Merge branch 'obsd-master' 2019-03-19 20:02:37 +00:00
nicm 161b57869e Add a cursor_character format. 2019-03-19 19:01:50 +00:00
Thomas Adam 962f255ee8 Merge branch 'obsd-master' 2019-03-18 21:24:49 +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
Thomas Adam 4cbf596dc5 Merge branch 'obsd-master' 2019-03-18 15:30:55 +00:00
Thomas Adam acb2413852 Merge branch 'obsd-master' 2019-03-18 15:07:51 +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
Thomas Adam 2c755e3c55 Merge branch 'obsd-master' 2019-03-14 22:02:39 +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
Thomas Adam 786f5e505e Merge branch 'obsd-master' 2019-03-13 20:02:36 +00:00
nicm 6dffbc4849 Tweak format_replace logging. 2019-03-13 18:09:12 +00:00
Thomas Adam e6fd429d58 Merge branch 'obsd-master' 2019-03-13 16:02:41 +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
Thomas Adam 3ec05e9405 Merge branch 'obsd-master' 2019-03-12 12:02: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
Thomas Adam 349aeb806a Merge branch 'obsd-master' 2019-03-07 22:02:42 +00:00
nicm f98c66ece8 Add a separate mode struct for the active window mode if any. 2019-03-07 20:24:21 +00:00
Thomas Adam a1009e7bd3 Merge branch 'obsd-master' 2019-03-07 20:02:41 +00:00
nicm 7f093fcddc Make adding mode formats a function pointer as well. 2019-03-07 19:01:21 +00:00
Thomas Adam efd01f3bfd Merge branch 'obsd-master' 2018-11-19 14:02:41 +00:00
nicm 749f67b7d8 evbuffer_new and bufferevent_new can both fail (when malloc fails) and
return NULL. GitHub issue 1547.
2018-11-19 13:35:40 +00:00
nicm 646995384d Support for windows larger than visible on the attached client. This has
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-10-18 08:38:01 +00:00
Thomas Adam a00cdcdfcb Merge branch 'obsd-master' 2018-09-27 11:02:37 +01:00
nicm 228e1a3951 Use same working directory rules for jobs as new windows rather than
always starting in home, GitHub issue 1488.
2018-09-27 07:43:18 +00:00
Nicholas Marriott ebaf54251a Add formats for when window is larger than client, and show offset in
status-right by default when larger.
2018-09-26 18:41:18 +01:00
Nicholas Marriott b74b047730 More of revert. 2018-09-26 16:49:03 +01:00
Nicholas Marriott 83b2d5c513 window_printable_flags needs an additional argument. 2018-09-25 09:55:49 +01:00
Thomas Adam 18b611bc8d Merge branch 'obsd-master' 2018-08-27 13:02:38 +01:00
nicm 79d2351ce8 Memory leaks, from Gang Fan in GitHub issue 1453. 2018-08-27 11:03:34 +00:00
Thomas Adam d64daf874f Merge branch 'obsd-master' 2018-08-26 11:02:38 +01:00
nicm 1b4402c823 Add q: format prefix to escape sh(1) special characters. Suggested by
someone ages ago and then more recently in GitHub issue 1449.
2018-08-26 09:28:42 +00:00
Thomas Adam da5d563375 Merge branch 'obsd-master' 2018-08-23 19:02:40 +01:00
nicm bceccc6b63 Move job struct into job.c. 2018-08-23 15:45:05 +00:00
Nicholas Marriott 641191ab20 Support for windows larger than the client.
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-20 15:22:14 +01:00
Thomas Adam 522d751eee Merge branch 'obsd-master' 2018-08-18 19:02:39 +01:00
nicm 3bc08b0dc0 Some tidying and helper functions. 2018-08-18 16:14:03 +00:00
Thomas Adam 850c26dd46 Merge branch 'obsd-master' 2018-07-04 13:02:25 +01:00
nicm 2fae6a5761 Add accessors for grid linedata member, for some future work. From Dan
Aloni.
2018-07-04 09:44:07 +00:00
Thomas Adam ead6d652ff Merge branch 'obsd-master' 2018-06-27 19:02:25 +01:00
nicm a14aa788d4 Allow any punctuation (except :) as separator in s/x/y/, not only
/. From JINNOUCHI Yasushi in GitHub issue 1386.
2018-06-27 17:36:10 +00:00
Thomas Adam 54cd292f09 Merge branch 'obsd-master' 2018-05-29 11:02:26 +01:00
nicm d1f5142dab If foo doesn't exist and can't be expanded in #{?foo,a,b} then assume it
is false.
2018-05-29 09:10:30 +00:00
Thomas Adam f0ac0d6793 Merge branch 'obsd-master' 2018-05-22 11:02:33 +01:00
nicm 2a04665626 Allow escaping , and } with # in #{}; GitHub issue 1332. 2018-05-22 08:49:12 +00:00
Thomas Adam 0e1b339c10 Merge branch 'obsd-master' 2018-04-18 17:02:28 +01:00
nicm 3dceddd70e Change how display-message uses the client. Originally it was only
intended as the target client where the message should be displayed but
at some point (perhaps when -p was added), it was used for format
expansion too. This means it can get a bit weird where you have client
formats expanding for a client with a different current session than the
target session.

However, it is nice that display-message can be used to show information
about a specific client. So change so that the -c client will be used if
the session matches the target session (-t or default), otherwise the
best client will be chosen.
2018-04-18 14:35:37 +00:00
Thomas Adam 9fd9952752 Merge branch 'obsd-master' 2018-03-08 10:02:26 +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
Thomas Adam 5a44e18490 Merge branch 'obsd-master' 2018-02-20 12:02:23 +00:00
nicm ab6f0bb348 Do not leak memory when working out job name in formats. 2018-02-20 10:43:46 +00:00
Thomas Adam 19afd842bf Merge branch 'obsd-master' 2018-01-18 16:02:25 +00:00
nicm 17d4c39f24 Discard all but the last line when reading from a #() command - the
callback is just going to be fired again straight away to go through all
the lines, it is better just to use the last one straight away.
2018-01-18 14:28:11 +00:00
Thomas Adam 8c29f7413b Merge branch 'obsd-master' 2017-11-02 20:01:26 +00:00
nicm 17655e5ba6 Format for group list of "other sessions" is a bit weird, just list all
the sessions in the group.
2017-11-02 18:52:05 +00:00
nicm 95850e1aca Tweak previous slightly so that current session is chosen if it is in
the group rather than first.
2017-11-02 18:43:51 +00:00
nicm c1f62f1fde Only show the first member of session groups in tree mode (-G flag
disables).
2017-11-02 18:27:35 +00:00
Thomas Adam 31901e3c07 Merge branch 'obsd-master'
Conflicts:
	server-fn.c
2017-10-20 12:36:29 +01:00
nicm a5fd5782f8 Show exit status and time in the remain-on-exit pane text, mostly from
Timo Boettcher in GitHub issue 1103.
2017-10-12 11:32:27 +00:00
Thomas Adam 27c3852103 Merge branch 'obsd-master'
Conflicts:
	tmux.1
2017-08-09 15:07:18 +01:00
nicm 5dd5543fe4 Add -F to choose-tree, choose-client, choose-buffer to specify the
format of each line, as well as adding a couple of formats needed for
the default display.
2017-08-09 11:43:45 +00:00
Thomas Adam e7b1e05bbd Merge branch 'obsd-master' 2017-08-02 14:01:10 +01:00
nicm 6f9b9655d7 Add selection_present format so commands in copy mode can use it, GitHub
issue 1028.
2017-08-02 11:10:48 +00:00
Thomas Adam 147740ed40 Merge branch 'obsd-master' 2017-07-27 14:01:13 +01:00
nicm 3df7c91f1a Add pane_at_left/right/top/bottom formats, from Amos Bird. 2017-07-27 10:42:05 +00:00
Thomas Adam 05062e7d2d Merge branch 'obsd-master' 2017-07-07 18:01:15 +01:00
nicm 9913cce3ba Add a pane_pipe format to show if pipe-pane is active, GitHub issue 990. 2017-07-07 14:39:45 +00:00
Thomas Adam 73b9328c1f Merge branch 'obsd-master'
Conflicts:
	window-buffer.c
2017-06-01 18:29:36 +01:00
nicm 248aa54bfd Style and spacing nits. 2017-05-31 17:56:48 +00:00
Nicholas Marriott 35008200bd Differences to OpenBSD. 2017-05-31 16:34:39 +01:00
Nicholas Marriott 113356c848 Build fixes. 2017-05-31 16:29:07 +01:00
Thomas Adam f17ecaa495 Merge branch 'obsd-master'
Conflicts:
	Makefile.am
	cfg.c
	server-client.c
2017-05-31 15:56:13 +01: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
Thomas Adam 5bc5fe5e7e Merge branch 'obsd-master' 2017-05-29 20:01:12 +01:00
nicm a2ace9da24 Add ||, && format operators and C: to search pane content. 2017-05-29 18:06:34 +00:00
Thomas Adam d3959a2118 Merge branch 'obsd-master' 2017-05-29 18:01:14 +01:00
nicm 1257501499 Add m: for fnmatch(3) format matching. 2017-05-29 15:43:48 +00:00
Nicholas Marriott b74b6dc77f Missed during merge. 2017-05-16 14:15:35 +01:00
Thomas Adam 9f9f8c8e76 Merge branch 'obsd-master' 2017-05-13 02:01:13 +01:00
nicm f688653710 Remove an unused variable. 2017-05-12 22:43:15 +00:00
Thomas Adam 20e30593a5 Merge branch 'obsd-master' 2017-05-12 16:01:14 +01:00
nicm 5d3cf2ff15 Only redraw single client, and tweak some logging. 2017-05-12 13:27:57 +00:00
Thomas Adam 7f813dcb6a Merge branch 'obsd-master' 2017-05-12 14:01:17 +01:00
nicm 7d3e2c83d4 Store copy mode search string in pane so search-again command works even
if you exit and reenter copy mode (it doesn't remember the position,
just the search string), suggested by espie@.
2017-05-12 10:45:38 +00:00
Thomas Adam a651b08a2f Merge branch 'obsd-master'
Conflicts:
	format.c
2017-05-09 15:44:13 +01:00
nicm 5fee4638e0 Add a format for the name of the pane's mode, lets it be used as a
conditional for key bindings.
2017-05-07 22:27:57 +00:00
nicm 2fef10b9ac Add some formats to look at the session window stack, suggested by Scott
ROCHFORD.
2017-05-05 11:59:47 +00:00
Thomas Adam 97ecb4f9d8 Merge branch 'obsd-master' 2017-05-03 08:01:14 +01:00
nicm ca6a121e63 Add a format for the last search string in copy mode and fix the prompt
so it can work when in -I, suggested by Suraj N Kurapati.
2017-05-03 05:53:34 +00:00
Thomas Adam e354b0e40f Merge branch 'obsd-master' 2017-05-01 14:01:14 +01:00
nicm 0ccfb61bb0 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.
2017-05-01 12:20:55 +00:00
Thomas Adam 4612419c14 Merge branch 'obsd-master' 2017-04-21 16:01:18 +01:00
nicm bba588752f Store state shared between multiple commands in the queue in a shared
structure.
2017-04-21 14:01:19 +00:00
Thomas Adam 48371216df Merge branch 'obsd-master' 2017-04-20 12:01:14 +01:00
nicm 21993105e5 Now that struct winlink has a session pointer, can remove some arguments. 2017-04-20 09:43:45 +00:00
nicm 0f25ad3ca3 There is no real need for window_printable_flags to allocate, make it
return a buffer from the stack.
2017-04-20 09:39:07 +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
Thomas Adam 85af9c9c9d Merge branch 'obsd-master' 2017-04-19 10:01:12 +01:00
nicm fa6deb5866 When the data we have buffered to write to a terminal grows beyond a
reasonable amount (currently width * height * 8 bytes), discard all
output to the terminal and start trying to redraw periodically
instead. Continue with this until the amount of data we are trying to
write falls to a low level again.

This helps to prevent tmux sitting on a huge buffer of data when there
are processes with fast output running inside tmux but the outside
terminal is slow.

A new client_discarded format holds the amount of data that has been
discarded due to this mechanism.

The three variables (when to start this, when to stop, and how often to
redraw) are basically "works for me" at the moment, this is going in to
see how it goes and if it causes problems for anyone else.
2017-04-19 06:52:27 +00:00
Thomas Adam a54309147d Merge branch 'obsd-master' 2017-04-18 18:01:17 +01:00
nicm fb3c5efa50 Add a format for number of bytes writtent to client, useful for debugging. 2017-04-18 15:44:17 +00:00
Thomas Adam 5f662d91db Merge branch 'obsd-master'
Conflicts:
	server-client.c
	tmux.1
2017-04-06 11:10:17 +01:00
nicm 9b28200578 Give each client a name. This defaults to the tty name as before but
falls back to an alternative if the tty name is not available. This is
clearer than overloading the client ttyname member and allows us to
remove the path stored in the tty struct, it should always be the same
as the client.
2017-04-05 10:49:46 +00:00
Thomas Adam 3ea36830f3 Merge branch 'obsd-master' 2017-03-08 14:01:23 +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
Thomas Adam 02e04477de Merge branch 'obsd-master'
Conflicts:
	server.c
2017-02-14 13:55:16 +00:00
nicm c6a3446398 Instead of numbering session groups, give them a name which may be given
to -t instead of a target session. Also allow them to contain only one
session.
2017-02-09 15:04:53 +00:00
Thomas Adam 5aaf640629 Merge branch 'obsd-master' 2017-02-07 20:01:14 +00:00
nicm 20f5e377fb Remove a debugging leftover. 2017-02-07 18:06:42 +00:00
Thomas Adam 6c333cc486 Merge branch 'obsd-master' 2017-02-03 14:01:13 +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
Thomas Adam 9b1f620aa0 Merge branch 'obsd-master' 2017-02-01 12:01:18 +00:00
nicm dd0c814779 Implement "all event" (1003) mouse mode but in a way that works. The
main issue is that if we have two panes, A with 1002 and B with 1003, we
need to set 1003 outside tmux in order to get all the mouse events, but
then we need to suppress the ones that pane A doesn't want. This is easy
in SGR mouse mode, because buttons == 3 is only used for movement events
(for other events the trailing m/M marks a release instead), but in
normal mouse mode we can't tell so easily. So for that, look at the
previous event instead - if it is drag+release as well, then the current
event is a movement event.
2017-02-01 09:55:07 +00:00
Thomas Adam d8da761d54 Merge branch 'obsd-master' 2017-01-31 00:01:12 +00:00
nicm 3408595f77 When a flag option is used in a format, it should use the number form
not string.
2017-01-30 21:41:17 +00:00
Thomas Adam 7e110b9d99 Merge branch 'obsd-master' 2017-01-16 15:36:02 +00:00
nicm 68db958477 getopt() has a struct option so just return to using options_entry. 2017-01-16 14:49:14 +00:00
Thomas Adam c9fcb76651 Merge branch 'obsd-master' 2017-01-15 22:01:11 +00:00