aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-12 16:37:43 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-12 16:37:43 +0000
commiteb9826f65d5584bc791cb35eb91ab6a5894b888c (patch)
tree567b60146870a5dcb5051964f84c7aee103fbabf /tty.c
parent56157444dea9539552c2d2f003ee0cc81a1422fc (diff)
downloadrtmux-eb9826f65d5584bc791cb35eb91ab6a5894b888c.tar.gz
rtmux-eb9826f65d5584bc791cb35eb91ab6a5894b888c.tar.bz2
rtmux-eb9826f65d5584bc791cb35eb91ab6a5894b888c.zip
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.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/tty.c b/tty.c
index 665d0871..29c84832 100644
--- a/tty.c
+++ b/tty.c
@@ -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;