aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-10-15 01:34:28 +0000
committerTiago Cunha <tcunha@gmx.com>2009-10-15 01:34:28 +0000
commit9e4a3d50f083458d2b53882c1594de4a1c74b766 (patch)
treed7707f88b63b2612ca936aff1e514981a65689fc
parent44fd6f4381cfe78df04f4fd49fb19f09bbd093f5 (diff)
downloadrtmux-9e4a3d50f083458d2b53882c1594de4a1c74b766.tar.gz
rtmux-9e4a3d50f083458d2b53882c1594de4a1c74b766.tar.bz2
rtmux-9e4a3d50f083458d2b53882c1594de4a1c74b766.zip
Sync OpenBSD patchset 396:
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.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tty.c b/tty.c
index c999e4be..a01bd181 100644
--- a/tty.c
+++ b/tty.c
@@ -1,4 +1,4 @@
-/* $Id: tty.c,v 1.146 2009-10-15 01:33:21 tcunha Exp $ */
+/* $Id: tty.c,v 1.147 2009-10-15 01:34:28 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -950,14 +950,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);
@@ -1048,6 +1050,7 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
}
}
+absolute:
/* Absolute movement. */
tty_putcode2(tty, TTYC_CUP, cy, cx);