Sync OpenBSD patchset 260:

vi(1)-style half page scroll in copy and scroll modes. Move the vi full page
scroll key to C-b instead of C-u and use C-u/C-d for half page scrolling with
vi keys. In emacs mode, half page scrolling is bound to M-Up and M-Down.

Suggested by merdely (about a year ago :-)).
This commit is contained in:
Tiago Cunha
2009-08-16 19:26:49 +00:00
parent 98e9e09588
commit 6f9a2ee50a
4 changed files with 46 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $Id: window-scroll.c,v 1.39 2009-08-16 19:23:07 tcunha Exp $ */
/* $Id: window-scroll.c,v 1.40 2009-08-16 19:26:49 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -165,6 +165,22 @@ window_scroll_key(struct window_pane *wp, unused struct client *c, int key)
data->oy -= n;
window_scroll_redraw_screen(wp);
break;
case MODEKEYCOPY_HALFPAGEUP:
n = screen_size_y(s) / 2;
if (data->oy + n > screen_hsize(&wp->base))
data->oy = screen_hsize(&wp->base);
else
data->oy += n;
window_scroll_redraw_screen(wp);
break;
case MODEKEYCOPY_HALFPAGEDOWN:
n = screen_size_y(s) / 2;
if (data->oy < n)
data->oy = 0;
else
data->oy -= n;
window_scroll_redraw_screen(wp);
break;
default:
break;
}