diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2021-10-28 18:57:07 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2021-10-28 18:57:07 +0000 |
commit | 40f24f1b3db0ace6aa40aca4a41a9878720525b3 (patch) | |
tree | 0593bd395c812defa701e2ef289a02fea6e79e7f | |
parent | b6b5aee1335f92875e10d3b333cf4ad9e9fdd141 (diff) |
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-- | usr.bin/tmux/tty.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index c799c67f9b9..480f40204fb 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.408 2021/10/25 09:22:17 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.409 2021/10/28 18:57:06 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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; |