aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicm <nicm>2021-10-28 18:57:06 +0000
committernicm <nicm>2021-10-28 18:57:06 +0000
commit4acad43013b7bb5f91103a68cfce591b1980ae17 (patch)
tree56b342aae3132b0cac38bcea60db398956454a56
parent49d33a4282dad9245cc644b9259b40ae94bc0063 (diff)
downloadrtmux-4acad43013b7bb5f91103a68cfce591b1980ae17.tar.gz
rtmux-4acad43013b7bb5f91103a68cfce591b1980ae17.tar.bz2
rtmux-4acad43013b7bb5f91103a68cfce591b1980ae17.zip
Do not force the cursor to move if it is in the automargin space at EOL
and that is where we want it to be, GitHub issue 2956.
-rw-r--r--tty.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tty.c b/tty.c
index 243eae56..62298a54 100644
--- a/tty.c
+++ b/tty.c
@@ -2278,17 +2278,25 @@ tty_cursor(struct tty *tty, u_int cx, u_int cy)
if (tty->flags & TTY_BLOCK)
return;
- if (cx > tty->sx - 1)
- cx = tty->sx - 1;
-
thisx = tty->cx;
thisy = tty->cy;
+ /*
+ * If in the automargin space, and want to be there, do not move.
+ * Otherwise, force the cursor to be in range (and complain).
+ */
+ if (cx == thisx && cy == thisy && cx == tty->sx)
+ return;
+ if (cx > tty->sx - 1) {
+ log_debug("%s: x too big %u > %u", __func__, cx, tty->sx - 1);
+ cx = tty->sx - 1;
+ }
+
/* No change. */
if (cx == thisx && cy == thisy)
return;
- /* Very end of the line, just use absolute movement. */
+ /* Currently at the very end of the line - use absolute movement. */
if (thisx > tty->sx - 1)
goto absolute;