Add cursor-down-and-cancel, from Mark Kelly.

This commit is contained in:
nicm 2019-09-09 08:01:21 +00:00
parent 7ce8135138
commit b31515fec3
2 changed files with 37 additions and 19 deletions

39
tmux.1
View File

@ -291,6 +291,12 @@ Prompt to search for text in open windows.
Display some information about the current window. Display some information about the current window.
.It l .It l
Move to the previously selected window. Move to the previously selected window.
.It m
Mark the current pane (see
.Ic select-pane
.Fl m ) .
.It M
Clear the marked pane.
.It n .It n
Change to the next window. Change to the next window.
.It o .It o
@ -301,12 +307,6 @@ Change to the previous window.
Briefly display pane indexes. Briefly display pane indexes.
.It r .It r
Force redraw of the attached client. Force redraw of the attached client.
.It m
Mark the current pane (see
.Ic select-pane
.Fl m ) .
.It M
Clear the marked pane.
.It s .It s
Select a new session for the attached client interactively. Select a new session for the attached client interactively.
.It t .It t
@ -1151,7 +1151,7 @@ The
.Fl P .Fl P
option prints information about the new session after it has been created. option prints information about the new session after it has been created.
By default, it uses the format By default, it uses the format
.Ql #{session_name}: .Ql #{session_name}:\&
but a different format may be specified with but a different format may be specified with
.Fl F . .Fl F .
.Pp .Pp
@ -1445,6 +1445,7 @@ The following commands are supported in copy mode:
.It Li "copy-selection-no-clear [<prefix>]" Ta "" Ta "" .It Li "copy-selection-no-clear [<prefix>]" Ta "" Ta ""
.It Li "copy-selection-and-cancel [<prefix>]" Ta "Enter" Ta "M-w" .It Li "copy-selection-and-cancel [<prefix>]" Ta "Enter" Ta "M-w"
.It Li "cursor-down" Ta "j" Ta "Down" .It Li "cursor-down" Ta "j" Ta "Down"
.It Li "cursor-down-and-cancel" Ta "" Ta ""
.It Li "cursor-left" Ta "h" Ta "Left" .It Li "cursor-left" Ta "h" Ta "Left"
.It Li "cursor-right" Ta "l" Ta "Right" .It Li "cursor-right" Ta "l" Ta "Right"
.It Li "cursor-up" Ta "k" Ta "Up" .It Li "cursor-up" Ta "k" Ta "Up"
@ -4086,7 +4087,7 @@ will append
if the pane title is more than five characters. if the pane title is more than five characters.
.Pp .Pp
Prefixing a time variable with Prefixing a time variable with
.Ql t: .Ql t:\&
will convert it to a string, so if will convert it to a string, so if
.Ql #{window_activity} .Ql #{window_activity}
gives gives
@ -4095,34 +4096,34 @@ gives
gives gives
.Ql Sun Oct 25 09:25:02 2015 . .Ql Sun Oct 25 09:25:02 2015 .
The The
.Ql b: .Ql b:\&
and and
.Ql d: .Ql d:\&
prefixes are prefixes are
.Xr basename 3 .Xr basename 3
and and
.Xr dirname 3 .Xr dirname 3
of the variable respectively. of the variable respectively.
.Ql q: .Ql q:\&
will escape will escape
.Xr sh 1 .Xr sh 1
special characters. special characters.
.Ql E: .Ql E:\&
will expand the format twice, for example will expand the format twice, for example
.Ql #{E:status-left} .Ql #{E:status-left}
is the result of expanding the content of the is the result of expanding the content of the
.Ic status-left .Ic status-left
option rather than the option itself. option rather than the option itself.
.Ql T: .Ql T:\&
is like is like
.Ql E: .Ql E:\&
but also expands but also expands
.Xr strftime 3 .Xr strftime 3
specifiers. specifiers.
.Ql S: , .Ql S:\& ,
.Ql W: .Ql W:\&
or or
.Ql P: .Ql P:\&
will loop over each session, window or pane and insert the format once will loop over each session, window or pane and insert the format once
for each. for each.
For windows and panes, two comma-separated formats may be given: For windows and panes, two comma-separated formats may be given:
@ -4133,7 +4134,7 @@ For example, to get a list of windows formatted like the status line:
.Ed .Ed
.Pp .Pp
A prefix of the form A prefix of the form
.Ql s/foo/bar/: .Ql s/foo/bar/:\&
will substitute will substitute
.Ql foo .Ql foo
with with
@ -4142,7 +4143,7 @@ throughout.
The first argument may be an extended regular expression and a final argument may be The first argument may be an extended regular expression and a final argument may be
.Ql i .Ql i
to ignore case, for example to ignore case, for example
.Ql s/a(.)/\e1x/i: .Ql s/a(.)/\e1x/i:\&
would change would change
.Ql abABab .Ql abABab
into into

View File

@ -819,6 +819,21 @@ window_copy_cmd_cursor_down(struct window_copy_cmd_state *cs)
return (WINDOW_COPY_CMD_NOTHING); return (WINDOW_COPY_CMD_NOTHING);
} }
static enum window_copy_cmd_action
window_copy_cmd_cursor_down_and_cancel(struct window_copy_cmd_state *cs)
{
struct window_mode_entry *wme = cs->wme;
struct window_copy_mode_data *data = wme->data;
u_int np = wme->prefix, cy;
cy = data->cy;
for (; np != 0; np--)
window_copy_cursor_down(wme, 0);
if (cy == data->cy && data->oy == 0)
return (WINDOW_COPY_CMD_CANCEL);
return (WINDOW_COPY_CMD_NOTHING);
}
static enum window_copy_cmd_action static enum window_copy_cmd_action
window_copy_cmd_cursor_left(struct window_copy_cmd_state *cs) window_copy_cmd_cursor_left(struct window_copy_cmd_state *cs)
{ {
@ -1810,6 +1825,8 @@ static const struct {
window_copy_cmd_copy_selection_and_cancel }, window_copy_cmd_copy_selection_and_cancel },
{ "cursor-down", 0, 0, { "cursor-down", 0, 0,
window_copy_cmd_cursor_down }, window_copy_cmd_cursor_down },
{ "cursor-down-and-cancel", 0, 0,
window_copy_cmd_cursor_down_and_cancel },
{ "cursor-left", 0, 0, { "cursor-left", 0, 0,
window_copy_cmd_cursor_left }, window_copy_cmd_cursor_left },
{ "cursor-right", 0, 0, { "cursor-right", 0, 0,