aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-12 14:54:19 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-12 14:54:19 +0000
commit0aab5811ca1d249b5c087241f77fbe21a6a1d31d (patch)
tree6bf3fbee1bc586a535e2e54cbc9c9834258bbdf9
parent687c4a9fabbd1f6a2b7c8ae9050f087c13565f1b (diff)
downloadrtmux-0aab5811ca1d249b5c087241f77fbe21a6a1d31d.tar.gz
rtmux-0aab5811ca1d249b5c087241f77fbe21a6a1d31d.tar.bz2
rtmux-0aab5811ca1d249b5c087241f77fbe21a6a1d31d.zip
Use absolute movement if right at the end of the line as it isn't a reliable
place to move from relatively.
-rw-r--r--tty.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tty.c b/tty.c
index 4172e38c..665d0871 100644
--- a/tty.c
+++ b/tty.c
@@ -945,14 +945,16 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
cx = tty->sx - 1;
thisx = tty->cx;
- if (thisx > tty->sx - 1)
- thisx = tty->sx - 1;
thisy = tty->cy;
/* No change. */
if (cx == thisx && cy == thisy)
return;
+ /* Very end of the line, just use absolute movement. */
+ if (thisx > tty->sx - 1)
+ goto absolute;
+
/* Move to home position (0, 0). */
if (cx == 0 && cy == 0 && tty_term_has(term, TTYC_HOME)) {
tty_putcode(tty, TTYC_HOME);
@@ -1043,6 +1045,7 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
}
}
+absolute:
/* Absolute movement. */
tty_putcode2(tty, TTYC_CUP, cy, cx);