summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2010-01-24 21:05:12 +0000
committernicm <nicm@openbsd.org>2010-01-24 21:05:12 +0000
commitee9c1ec6a3b682a412b73f879a90858e8430b91e (patch)
treef4b45be85cc6fd6bb483a9790abf9383919a0c64
parent"Fix" crash caused by FAT32 re-use of small buf from buffer cache, (diff)
downloadwireguard-openbsd-ee9c1ec6a3b682a412b73f879a90858e8430b91e.tar.xz
wireguard-openbsd-ee9c1ec6a3b682a412b73f879a90858e8430b91e.zip
Redraw properly when scrolling backward and the cursor is on the last
line. Based on a fix from Micah Cowan.
-rw-r--r--usr.bin/tmux/window-copy.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 60b2407e07f..9c0c9a3385c 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.35 2009/12/03 22:50:10 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.36 2010/01/24 21:05:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1075,6 +1075,7 @@ void
window_copy_cursor_up(struct window_pane *wp, int scroll_only)
{
struct window_copy_mode_data *data = wp->modedata;
+ struct screen *s = &data->screen;
u_int ox, oy, px, py;
oy = screen_hsize(&wp->base) + data->cy - data->oy;
@@ -1087,12 +1088,20 @@ window_copy_cursor_up(struct window_pane *wp, int scroll_only)
data->cx = data->lastcx;
if (scroll_only || data->cy == 0) {
window_copy_scroll_down(wp, 1);
- if (scroll_only)
- window_copy_redraw_lines(wp, data->cy, 2);
+ if (scroll_only) {
+ if (data->cy == screen_size_y(s) - 1)
+ window_copy_redraw_lines(wp, data->cy, 1);
+ else
+ window_copy_redraw_lines(wp, data->cy, 2);
+ }
} else {
window_copy_update_cursor(wp, data->cx, data->cy - 1);
- if (window_copy_update_selection(wp))
- window_copy_redraw_lines(wp, data->cy, 2);
+ if (window_copy_update_selection(wp)) {
+ if (data->cy == screen_size_y(s) - 1)
+ window_copy_redraw_lines(wp, data->cy, 1);
+ else
+ window_copy_redraw_lines(wp, data->cy, 2);
+ }
}
py = screen_hsize(&wp->base) + data->cy - data->oy;