aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-15 01:36:53 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-15 01:36:53 +0000
commit858b8b190b57da0105a48228ef9ede2f1d7562da (patch)
tree49a74ef106815a751d6f27314b32e31a8bf9d027 /tty.c
parent7af01a4afbcfeb80814d776afa1d48f7322fa958 (diff)
downloadrtmux-858b8b190b57da0105a48228ef9ede2f1d7562da.tar.gz
rtmux-858b8b190b57da0105a48228ef9ede2f1d7562da.tar.bz2
rtmux-858b8b190b57da0105a48228ef9ede2f1d7562da.zip
Sync OpenBSD patchset 398:
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.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/tty.c b/tty.c
index a01bd181..3dd933ea 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.147 2009-10-15 01:34:28 tcunha Exp $ */
+/* $Id: tty.c,v 1.148 2009-10-15 01:36:53 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1032,15 +1032,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;