Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2017-11-16 12:01:18 +00:00
commit 5fddddbe21
2 changed files with 35 additions and 12 deletions

12
tmux.1
View File

@ -1126,9 +1126,10 @@ The following commands are supported in copy mode:
.It Li "end-of-line" Ta "$" Ta "C-e" .It Li "end-of-line" Ta "$" Ta "C-e"
.It Li "goto-line <line>" Ta ":" Ta "g" .It Li "goto-line <line>" Ta ":" Ta "g"
.It Li "halfpage-down" Ta "C-d" Ta "M-Down" .It Li "halfpage-down" Ta "C-d" Ta "M-Down"
.It Li "halfpage-down-and-cancel" Ta "" Ta ""
.It Li "halfpage-up" Ta "C-u" Ta "M-Up" .It Li "halfpage-up" Ta "C-u" Ta "M-Up"
.It Li "history-bottom" Ta "G" Ta "M-<" .It Li "history-bottom" Ta "G" Ta "M->"
.It Li "history-top" Ta "g" Ta "M->" .It Li "history-top" Ta "g" Ta "M-<"
.It Li "jump-again" Ta ";" Ta ";" .It Li "jump-again" Ta ";" Ta ";"
.It Li "jump-backward <to>" Ta "F" Ta "F" .It Li "jump-backward <to>" Ta "F" Ta "F"
.It Li "jump-forward <to>" Ta "f" Ta "f" .It Li "jump-forward <to>" Ta "f" Ta "f"
@ -1143,12 +1144,14 @@ The following commands are supported in copy mode:
.It Li "next-word-end" Ta "e" Ta "M-f" .It Li "next-word-end" Ta "e" Ta "M-f"
.It Li "other-end" Ta "o" Ta "" .It Li "other-end" Ta "o" Ta ""
.It Li "page-down" Ta "C-f" Ta "PageDown" .It Li "page-down" Ta "C-f" Ta "PageDown"
.It Li "page-down-and-cancel" Ta "" Ta ""
.It Li "page-up" Ta "C-b" Ta "PageUp" .It Li "page-up" Ta "C-b" Ta "PageUp"
.It Li "previous-paragraph" Ta "{" Ta "M-{" .It Li "previous-paragraph" Ta "{" Ta "M-{"
.It Li "previous-space" Ta "B" Ta "" .It Li "previous-space" Ta "B" Ta ""
.It Li "previous-word" Ta "b" Ta "M-b" .It Li "previous-word" Ta "b" Ta "M-b"
.It Li "rectangle-toggle" Ta "v" Ta "R" .It Li "rectangle-toggle" Ta "v" Ta "R"
.It Li "scroll-down" Ta "C-e" Ta "C-Down" .It Li "scroll-down" Ta "C-e" Ta "C-Down"
.It Li "scroll-down-and-cancel" Ta "" Ta ""
.It Li "scroll-up" Ta "C-y" Ta "C-Up" .It Li "scroll-up" Ta "C-y" Ta "C-Up"
.It Li "search-again" Ta "n" Ta "n" .It Li "search-again" Ta "n" Ta "n"
.It Li "search-backward <for>" Ta "?" Ta "" .It Li "search-backward <for>" Ta "?" Ta ""
@ -1162,6 +1165,11 @@ The following commands are supported in copy mode:
.It Li "top-line" Ta "H" Ta "M-R" .It Li "top-line" Ta "H" Ta "M-R"
.El .El
.Pp .Pp
The
.Ql -and-cancel
variants of some commands exit copy mode after they have completed (for copy
commands) or when the cursor reaches the bottom (for scrolling commands).
.Pp
The next and previous word keys use space and the The next and previous word keys use space and the
.Ql - , .Ql - ,
.Ql _ .Ql _

View File

@ -30,7 +30,7 @@ static void window_copy_command(struct window_pane *, struct client *,
static struct screen *window_copy_init(struct window_pane *, static struct screen *window_copy_init(struct window_pane *,
struct cmd_find_state *, struct args *); struct cmd_find_state *, struct args *);
static void window_copy_free(struct window_pane *); static void window_copy_free(struct window_pane *);
static int window_copy_pagedown(struct window_pane *, int); static int window_copy_pagedown(struct window_pane *, int, int);
static void window_copy_next_paragraph(struct window_pane *); static void window_copy_next_paragraph(struct window_pane *);
static void window_copy_previous_paragraph(struct window_pane *); static void window_copy_previous_paragraph(struct window_pane *);
static void window_copy_resize(struct window_pane *, u_int, u_int); static void window_copy_resize(struct window_pane *, u_int, u_int);
@ -392,7 +392,7 @@ window_copy_pageup(struct window_pane *wp, int half_page)
} }
static int static int
window_copy_pagedown(struct window_pane *wp, int half_page) window_copy_pagedown(struct window_pane *wp, int half_page, int scroll_exit)
{ {
struct window_copy_mode_data *data = wp->modedata; struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen; struct screen *s = &data->screen;
@ -431,7 +431,7 @@ window_copy_pagedown(struct window_pane *wp, int half_page)
window_copy_cursor_end_of_line(wp); window_copy_cursor_end_of_line(wp);
} }
if (data->scroll_exit && data->oy == 0) if (scroll_exit && data->oy == 0)
return (1); return (1);
window_copy_update_selection(wp, 1); window_copy_update_selection(wp, 1);
window_copy_redraw_screen(wp); window_copy_redraw_screen(wp);
@ -524,7 +524,7 @@ window_copy_command(struct window_pane *wp, struct client *c, struct session *s,
struct screen *sn = &data->screen; struct screen *sn = &data->screen;
const char *command, *argument, *ws; const char *command, *argument, *ws;
u_int np = wp->modeprefix; u_int np = wp->modeprefix;
int cancel = 0, redraw = 0; int cancel = 0, redraw = 0, scroll_exit;
char prefix; char prefix;
if (args->argc == 0) if (args->argc == 0)
@ -629,9 +629,14 @@ window_copy_command(struct window_pane *wp, struct client *c, struct session *s,
} }
if (strcmp(command, "end-of-line") == 0) if (strcmp(command, "end-of-line") == 0)
window_copy_cursor_end_of_line(wp); window_copy_cursor_end_of_line(wp);
if (strcmp(command, "halfpage-down") == 0) { if (strcmp(command, "halfpage-down") == 0 ||
strcmp(command, "halfpage-down-and-cancel") == 0) {
if (strcmp(command, "halfpage-down-and-cancel") == 0)
scroll_exit = 1;
else
scroll_exit = data->scroll_exit;
for (; np != 0; np--) { for (; np != 0; np--) {
if (window_copy_pagedown(wp, 1)) { if (window_copy_pagedown(wp, 1, scroll_exit)) {
cancel = 1; cancel = 1;
break; break;
} }
@ -727,9 +732,14 @@ window_copy_command(struct window_pane *wp, struct client *c, struct session *s,
if ((np % 2) != 0) if ((np % 2) != 0)
window_copy_other_end(wp); window_copy_other_end(wp);
} }
if (strcmp(command, "page-down") == 0) { if (strcmp(command, "page-down") == 0 ||
strcmp(command, "page-down-and-cancel") == 0) {
if (strcmp(command, "page-down-and-cancel") == 0)
scroll_exit = 1;
else
scroll_exit = data->scroll_exit;
for (; np != 0; np--) { for (; np != 0; np--) {
if (window_copy_pagedown(wp, 0)) { if (window_copy_pagedown(wp, 0, scroll_exit)) {
cancel = 1; cancel = 1;
break; break;
} }
@ -756,10 +766,15 @@ window_copy_command(struct window_pane *wp, struct client *c, struct session *s,
sn->sel.lineflag = LINE_SEL_NONE; sn->sel.lineflag = LINE_SEL_NONE;
window_copy_rectangle_toggle(wp); window_copy_rectangle_toggle(wp);
} }
if (strcmp(command, "scroll-down") == 0) { if (strcmp(command, "scroll-down") == 0 ||
strcmp(command, "scroll-down-and-cancel") == 0) {
if (strcmp(command, "scroll-down-and-cancel") == 0)
scroll_exit = 1;
else
scroll_exit = data->scroll_exit;
for (; np != 0; np--) for (; np != 0; np--)
window_copy_cursor_down(wp, 1); window_copy_cursor_down(wp, 1);
if (data->scroll_exit && data->oy == 0) if (scroll_exit && data->oy == 0)
cancel = 1; cancel = 1;
} }
if (strcmp(command, "scroll-up") == 0) { if (strcmp(command, "scroll-up") == 0) {