=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window-copy.c,v retrieving revision 1.185 retrieving revision 1.186 diff -c -r1.185 -r1.186 *** src/usr.bin/tmux/window-copy.c 2017/11/13 11:49:11 1.185 --- src/usr.bin/tmux/window-copy.c 2017/11/16 11:16:15 1.186 *************** *** 1,4 **** ! /* $OpenBSD: window-copy.c,v 1.185 2017/11/13 11:49:11 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: window-copy.c,v 1.186 2017/11/16 11:16:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 30,36 **** static struct screen *window_copy_init(struct window_pane *, struct cmd_find_state *, struct args *); static void window_copy_free(struct window_pane *); ! static int window_copy_pagedown(struct window_pane *, int); static void window_copy_next_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); --- 30,36 ---- static struct screen *window_copy_init(struct window_pane *, struct cmd_find_state *, struct args *); static void window_copy_free(struct window_pane *); ! static int window_copy_pagedown(struct window_pane *, int, int); static void window_copy_next_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); *************** *** 392,398 **** } static int ! window_copy_pagedown(struct window_pane *wp, int half_page) { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; --- 392,398 ---- } static int ! window_copy_pagedown(struct window_pane *wp, int half_page, int scroll_exit) { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; *************** *** 431,437 **** window_copy_cursor_end_of_line(wp); } ! if (data->scroll_exit && data->oy == 0) return (1); window_copy_update_selection(wp, 1); window_copy_redraw_screen(wp); --- 431,437 ---- window_copy_cursor_end_of_line(wp); } ! if (scroll_exit && data->oy == 0) return (1); window_copy_update_selection(wp, 1); window_copy_redraw_screen(wp); *************** *** 524,530 **** struct screen *sn = &data->screen; const char *command, *argument, *ws; u_int np = wp->modeprefix; ! int cancel = 0, redraw = 0; char prefix; if (args->argc == 0) --- 524,530 ---- struct screen *sn = &data->screen; const char *command, *argument, *ws; u_int np = wp->modeprefix; ! int cancel = 0, redraw = 0, scroll_exit; char prefix; if (args->argc == 0) *************** *** 629,637 **** } if (strcmp(command, "end-of-line") == 0) window_copy_cursor_end_of_line(wp); ! if (strcmp(command, "halfpage-down") == 0) { for (; np != 0; np--) { ! if (window_copy_pagedown(wp, 1)) { cancel = 1; break; } --- 629,642 ---- } if (strcmp(command, "end-of-line") == 0) window_copy_cursor_end_of_line(wp); ! 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--) { ! if (window_copy_pagedown(wp, 1, scroll_exit)) { cancel = 1; break; } *************** *** 727,735 **** if ((np % 2) != 0) window_copy_other_end(wp); } ! if (strcmp(command, "page-down") == 0) { for (; np != 0; np--) { ! if (window_copy_pagedown(wp, 0)) { cancel = 1; break; } --- 732,745 ---- if ((np % 2) != 0) window_copy_other_end(wp); } ! 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--) { ! if (window_copy_pagedown(wp, 0, scroll_exit)) { cancel = 1; break; } *************** *** 756,765 **** sn->sel.lineflag = LINE_SEL_NONE; window_copy_rectangle_toggle(wp); } ! if (strcmp(command, "scroll-down") == 0) { for (; np != 0; np--) window_copy_cursor_down(wp, 1); ! if (data->scroll_exit && data->oy == 0) cancel = 1; } if (strcmp(command, "scroll-up") == 0) { --- 766,780 ---- sn->sel.lineflag = LINE_SEL_NONE; window_copy_rectangle_toggle(wp); } ! 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--) window_copy_cursor_down(wp, 1); ! if (scroll_exit && data->oy == 0) cancel = 1; } if (strcmp(command, "scroll-up") == 0) {