diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-02-14 07:27:52 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-02-14 07:27:52 -0800 |
commit | a632605cdf74fe0ad72c3a234e0cbf748f25bcff (patch) | |
tree | 96e7ce351e315235a0a29dfac14854c8ab8513c8 /linenoise | |
parent | fdb485cac7236e2b66cbf0c1c61b95a598c3dabc (diff) | |
download | txr-a632605cdf74fe0ad72c3a234e0cbf748f25bcff.tar.gz txr-a632605cdf74fe0ad72c3a234e0cbf748f25bcff.tar.bz2 txr-a632605cdf74fe0ad72c3a234e0cbf748f25bcff.zip |
linenoise: bugfix: vertical skip problem.
This relates to the optimized insert at the end of the line.
The following bug manifests itself. When the cursor is not at
the bottom of the screen (e.g. fresh terminal after a clear
screen), if blank lines are added to the buffer and then
backspace is hit, the cursor strangely jumps down by multiple
lines prior to the refresh.
In a Windows CMD.EXE window, this shows up even at the bottom
of the screen, because the CMD.EXE console responds to a
downward movement (ESC[<n>B) beyond the bottom row by
scrolling the screen, rather than clipping the movement.
* linenoise/linenoise.c (refresh_multiline): When doing the
elided refresh (l->need_refresh == 2), we must update not only
l->maxrows but also l->oldrow. Otherwise when we do
the real update, it will think that the cursor is on the first
line, and try to move down to the last line.
Diffstat (limited to 'linenoise')
-rw-r--r-- | linenoise/linenoise.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index 9869737d..7e22d21f 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -1146,8 +1146,10 @@ static void refresh_multiline(lino_t *l) { if (rows > l->maxrows) l->maxrows = rows; - if (l->need_refresh == 2) + if (l->need_refresh == 2) { + l->oldrow = nrow; return; + } /* First step: clear all the lines used before. To do so start by * going to the last row. */ |