summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-12 16:37:44 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-12 16:37:44 +0000
commit9838933fda3727cae18faeaaf188da2031bb3416 (patch)
treee8d91ca1dca7a339f0ddf86a08bc69cdd6295cd8
parent15ec860014070b2ec0d0c7443fb58d5d989c4355 (diff)
If the vertical cursor movement crosses the scroll region, CUU and CUD
shouldn't be used even if VPA isn't present - in that case CUP should be used.
-rw-r--r--usr.bin/tmux/tty.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index cb4180cf0c6..b1c3c9d2bbd 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.43 2009/10/12 14:54:19 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.44 2009/10/12 16:37:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1027,15 +1027,16 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
change = thisy - cy; /* +ve up, -ve down */
/*
- * Use VPA if change is larger than absolute or if this change
+ * Try to use VPA if change is larger than absolute or if this change
* would cross the scroll region, otherwise use CUU/CUD.
*/
- if ((abs(change) > cy ||
+ if (abs(change) > cy ||
(change < 0 && cy - change > tty->rlower) ||
- (change > 0 && cy - change < tty->rupper)) &&
- tty_term_has(term, TTYC_VPA)) {
- tty_putcode1(tty, TTYC_VPA, cy);
- goto out;
+ (change > 0 && cy - change < tty->rupper)) {
+ if (tty_term_has(term, TTYC_VPA)) {
+ tty_putcode1(tty, TTYC_VPA, cy);
+ goto out;
+ }
} else if (change > 0 && tty_term_has(term, TTYC_CUU)) {
tty_putcode1(tty, TTYC_CUU, change);
goto out;