Add a copy-mode -H flag to hide the position marker in the top right.

This commit is contained in:
nicm 2020-03-12 13:19:20 +00:00
parent f7bc753442
commit 7863445e5d
3 changed files with 9 additions and 4 deletions

View File

@ -30,8 +30,8 @@ const struct cmd_entry cmd_copy_mode_entry = {
.name = "copy-mode", .name = "copy-mode",
.alias = NULL, .alias = NULL,
.args = { "Met:u", 0, 0 }, .args = { "eHMt:u", 0, 0 },
.usage = "[-Mu] " CMD_TARGET_PANE_USAGE, .usage = "[-eHMu] " CMD_TARGET_PANE_USAGE,
.target = { 't', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 },

5
tmux.1
View File

@ -1565,7 +1565,7 @@ The synopsis for the
command is: command is:
.Bl -tag -width Ds .Bl -tag -width Ds
.It Xo Ic copy-mode .It Xo Ic copy-mode
.Op Fl Meu .Op Fl eHMu
.Op Fl t Ar target-pane .Op Fl t Ar target-pane
.Xc .Xc
Enter copy mode. Enter copy mode.
@ -1575,6 +1575,9 @@ option scrolls one page up.
.Fl M .Fl M
begins a mouse drag (only valid if bound to a mouse key binding, see begins a mouse drag (only valid if bound to a mouse key binding, see
.Sx MOUSE SUPPORT ) . .Sx MOUSE SUPPORT ) .
.Fl H
hides the position indicator in the top right.
.Pp
.Fl e .Fl e
specifies that scrolling to the bottom of the history (to the visible screen) specifies that scrolling to the bottom of the history (to the visible screen)
should exit copy mode. should exit copy mode.

View File

@ -230,6 +230,7 @@ struct window_copy_mode_data {
} lineflag; /* line selection mode */ } lineflag; /* line selection mode */
int rectflag; /* in rectangle copy mode? */ int rectflag; /* in rectangle copy mode? */
int scroll_exit; /* exit on scroll to end? */ int scroll_exit; /* exit on scroll to end? */
int hide_position; /* hide position marker */
enum { enum {
SEL_CHAR, /* select one char at a time */ SEL_CHAR, /* select one char at a time */
@ -345,6 +346,7 @@ window_copy_init(struct window_mode_entry *wme,
data->cy = data->backing->cy; data->cy = data->backing->cy;
data->scroll_exit = args_has(args, 'e'); data->scroll_exit = args_has(args, 'e');
data->hide_position = args_has(args, 'H');
data->screen.cx = data->cx; data->screen.cx = data->cx;
data->screen.cy = data->cy; data->screen.cy = data->cy;
@ -2774,7 +2776,7 @@ window_copy_write_line(struct window_mode_entry *wme,
style_apply(&gc, oo, "mode-style"); style_apply(&gc, oo, "mode-style");
gc.flags |= GRID_FLAG_NOPALETTE; gc.flags |= GRID_FLAG_NOPALETTE;
if (py == 0 && s->rupper < s->rlower) { if (py == 0 && s->rupper < s->rlower && !data->hide_position) {
if (data->searchmark == NULL) { if (data->searchmark == NULL) {
size = xsnprintf(hdr, sizeof hdr, size = xsnprintf(hdr, sizeof hdr,
"[%u/%u]", data->oy, screen_hsize(data->backing)); "[%u/%u]", data->oy, screen_hsize(data->backing));