summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/window-copy.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-08-13 22:11:43 +0000
committernicm <nicm@openbsd.org>2009-08-13 22:11:43 +0000
commitc395eedd81c66fc0b2b789488ec10dee3b585ec3 (patch)
treece3fbb60d7afab5cb455bbea171af01edc887c44 /usr.bin/tmux/window-copy.c
parentDisable mode-mouse (mouse in copy/choice mode) by default as it isn't very (diff)
downloadwireguard-openbsd-c395eedd81c66fc0b2b789488ec10dee3b585ec3.tar.xz
wireguard-openbsd-c395eedd81c66fc0b2b789488ec10dee3b585ec3.zip
Scroll by two less than the number of lines in the screen, like emacs, rather
than by the entire screen, to make it easier to pull things out from under the line indicator. Suggested by claudio.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
-rw-r--r--usr.bin/tmux/window-copy.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 2e915bb145c..c2d64ed4be7 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.18 2009/08/13 19:35:20 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.19 2009/08/13 22:11:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -130,11 +130,15 @@ window_copy_pageup(struct window_pane *wp)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
+ u_int n;
- if (data->oy + screen_size_y(s) > screen_hsize(&wp->base))
+ n = 1;
+ if (screen_size_y(s) > 2)
+ n = screen_size_y(s) - 2;
+ if (data->oy + n > screen_hsize(&wp->base))
data->oy = screen_hsize(&wp->base);
else
- data->oy += screen_size_y(s);
+ data->oy += n;
window_copy_update_selection(wp);
window_copy_redraw_screen(wp);
}
@@ -167,6 +171,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
+ u_int n;
switch (mode_key_lookup(&data->mdata, key)) {
case MODEKEYCOPY_CANCEL:
@@ -188,10 +193,13 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
window_copy_pageup(wp);
break;
case MODEKEYCOPY_NEXTPAGE:
- if (data->oy < screen_size_y(s))
+ n = 1;
+ if (screen_size_y(s) > 2)
+ n = screen_size_y(s) - 2;
+ if (data->oy < n)
data->oy = 0;
else
- data->oy -= screen_size_y(s);
+ data->oy -= n;
window_copy_update_selection(wp);
window_copy_redraw_screen(wp);
break;