=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window-copy.c,v retrieving revision 1.132 retrieving revision 1.133 diff -c -r1.132 -r1.133 *** src/usr.bin/tmux/window-copy.c 2015/08/29 09:25:00 1.132 --- src/usr.bin/tmux/window-copy.c 2015/09/13 13:31:40 1.133 *************** *** 1,4 **** ! /* $OpenBSD: window-copy.c,v 1.132 2015/08/29 09:25:00 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: window-copy.c,v 1.133 2015/09/13 13:31:40 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott *************** *** 135,141 **** u_int selx; u_int sely; ! u_int rectflag; /* are we in rectangle copy mode? */ u_int cx; u_int cy; --- 135,142 ---- u_int selx; u_int sely; ! int rectflag; /* in rectangle copy mode? */ ! int scroll_exit; /* exit on scroll to end? */ u_int cx; u_int cy; *************** *** 175,180 **** --- 176,182 ---- data->backing_written = 0; data->rectflag = 0; + data->scroll_exit = 0; data->inputtype = WINDOW_COPY_OFF; data->inputprompt = NULL; *************** *** 206,212 **** } void ! window_copy_init_from_pane(struct window_pane *wp) { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; --- 208,214 ---- } void ! window_copy_init_from_pane(struct window_pane *wp, u_int scroll_exit) { struct window_copy_mode_data *data = wp->modedata; struct screen *s = &data->screen; *************** *** 219,224 **** --- 221,227 ---- data->backing = &wp->base; data->cx = data->backing->cx; data->cy = data->backing->cy; + data->scroll_exit = scroll_exit; s->cx = data->cx; s->cy = data->cy; *************** *** 419,424 **** --- 422,434 ---- } cmd = mode_key_lookup(&data->mdata, key, &arg); + if (cmd != MODEKEYCOPY_PREVIOUSPAGE && + cmd != MODEKEYCOPY_NEXTPAGE && + cmd != MODEKEYCOPY_SCROLLUP && + cmd != MODEKEYCOPY_SCROLLDOWN && + cmd != MODEKEYCOPY_HALFPAGEUP && + cmd != MODEKEYCOPY_HALFPAGEDOWN) + data->scroll_exit = 0; switch (cmd) { case MODEKEYCOPY_APPENDSELECTION: if (sess != NULL) { *************** *** 461,466 **** --- 471,480 ---- case MODEKEYCOPY_SCROLLDOWN: for (; np != 0; np--) window_copy_cursor_down(wp, 1); + if (data->scroll_exit && data->oy == 0) { + window_pane_reset_mode(wp); + return; + } break; case MODEKEYCOPY_PREVIOUSPAGE: for (; np != 0; np--) *************** *** 476,481 **** --- 490,499 ---- else data->oy -= n; } + if (data->scroll_exit && data->oy == 0) { + window_pane_reset_mode(wp); + return; + } window_copy_update_selection(wp, 1); window_copy_redraw_screen(wp); break; *************** *** 497,502 **** --- 515,524 ---- data->oy = 0; else data->oy -= n; + } + if (data->scroll_exit && data->oy == 0) { + window_pane_reset_mode(wp); + return; } window_copy_update_selection(wp, 1); window_copy_redraw_screen(wp);