aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicm <nicm>2019-09-09 08:01:21 +0000
committernicm <nicm>2019-09-09 08:01:21 +0000
commitb31515fec36e8eb6eb57a75825e9840d8bd68a2e (patch)
treebab4a53e5fd7ced8975ad2ac99f2995ab4f3b3d1
parent7ce813513818e58d3d35116c868bd6c8d866c997 (diff)
downloadrtmux-b31515fec36e8eb6eb57a75825e9840d8bd68a2e.tar.gz
rtmux-b31515fec36e8eb6eb57a75825e9840d8bd68a2e.tar.bz2
rtmux-b31515fec36e8eb6eb57a75825e9840d8bd68a2e.zip
Add cursor-down-and-cancel, from Mark Kelly.
-rw-r--r--tmux.139
-rw-r--r--window-copy.c17
2 files changed, 37 insertions, 19 deletions
diff --git a/tmux.1 b/tmux.1
index 694e46d0..bd96564f 100644
--- a/tmux.1
+++ b/tmux.1
@@ -291,6 +291,12 @@ Prompt to search for text in open windows.
Display some information about the current window.
.It l
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
Change to the next window.
.It o
@@ -301,12 +307,6 @@ Change to the previous window.
Briefly display pane indexes.
.It r
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
Select a new session for the attached client interactively.
.It t
@@ -1151,7 +1151,7 @@ The
.Fl P
option prints information about the new session after it has been created.
By default, it uses the format
-.Ql #{session_name}:
+.Ql #{session_name}:\&
but a different format may be specified with
.Fl F .
.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-and-cancel [<prefix>]" Ta "Enter" Ta "M-w"
.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-right" Ta "l" Ta "Right"
.It Li "cursor-up" Ta "k" Ta "Up"
@@ -4086,7 +4087,7 @@ will append
if the pane title is more than five characters.
.Pp
Prefixing a time variable with
-.Ql t:
+.Ql t:\&
will convert it to a string, so if
.Ql #{window_activity}
gives
@@ -4095,34 +4096,34 @@ gives
gives
.Ql Sun Oct 25 09:25:02 2015 .
The
-.Ql b:
+.Ql b:\&
and
-.Ql d:
+.Ql d:\&
prefixes are
.Xr basename 3
and
.Xr dirname 3
of the variable respectively.
-.Ql q:
+.Ql q:\&
will escape
.Xr sh 1
special characters.
-.Ql E:
+.Ql E:\&
will expand the format twice, for example
.Ql #{E:status-left}
is the result of expanding the content of the
.Ic status-left
option rather than the option itself.
-.Ql T:
+.Ql T:\&
is like
-.Ql E:
+.Ql E:\&
but also expands
.Xr strftime 3
specifiers.
-.Ql S: ,
-.Ql W:
+.Ql S:\& ,
+.Ql W:\&
or
-.Ql P:
+.Ql P:\&
will loop over each session, window or pane and insert the format once
for each.
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
.Pp
A prefix of the form
-.Ql s/foo/bar/:
+.Ql s/foo/bar/:\&
will substitute
.Ql foo
with
@@ -4142,7 +4143,7 @@ throughout.
The first argument may be an extended regular expression and a final argument may be
.Ql i
to ignore case, for example
-.Ql s/a(.)/\e1x/i:
+.Ql s/a(.)/\e1x/i:\&
would change
.Ql abABab
into
diff --git a/window-copy.c b/window-copy.c
index c7c44fe9..b90130c7 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -820,6 +820,21 @@ window_copy_cmd_cursor_down(struct window_copy_cmd_state *cs)
}
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
window_copy_cmd_cursor_left(struct window_copy_cmd_state *cs)
{
struct window_mode_entry *wme = cs->wme;
@@ -1810,6 +1825,8 @@ static const struct {
window_copy_cmd_copy_selection_and_cancel },
{ "cursor-down", 0, 0,
window_copy_cmd_cursor_down },
+ { "cursor-down-and-cancel", 0, 0,
+ window_copy_cmd_cursor_down_and_cancel },
{ "cursor-left", 0, 0,
window_copy_cmd_cursor_left },
{ "cursor-right", 0, 0,