mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-08 09:14:22 +01:00
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.
This commit is contained in:
parent
44fd6f4381
commit
9e4a3d50f0
9
tty.c
9
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>
|
* 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;
|
cx = tty->sx - 1;
|
||||||
|
|
||||||
thisx = tty->cx;
|
thisx = tty->cx;
|
||||||
if (thisx > tty->sx - 1)
|
|
||||||
thisx = tty->sx - 1;
|
|
||||||
thisy = tty->cy;
|
thisy = tty->cy;
|
||||||
|
|
||||||
/* No change. */
|
/* No change. */
|
||||||
if (cx == thisx && cy == thisy)
|
if (cx == thisx && cy == thisy)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Very end of the line, just use absolute movement. */
|
||||||
|
if (thisx > tty->sx - 1)
|
||||||
|
goto absolute;
|
||||||
|
|
||||||
/* Move to home position (0, 0). */
|
/* Move to home position (0, 0). */
|
||||||
if (cx == 0 && cy == 0 && tty_term_has(term, TTYC_HOME)) {
|
if (cx == 0 && cy == 0 && tty_term_has(term, TTYC_HOME)) {
|
||||||
tty_putcode(tty, 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. */
|
/* Absolute movement. */
|
||||||
tty_putcode2(tty, TTYC_CUP, cy, cx);
|
tty_putcode2(tty, TTYC_CUP, cy, cx);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user