summaryrefslogtreecommitdiffstats
path: root/linenoise
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-02-26 08:30:38 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-02-26 08:30:38 -0800
commit116ab6dc94eadc629b118ad618ad4a3145fad6b8 (patch)
tree19d7ff3d425623bc0d01ebcefc76d3bc63618729 /linenoise
parent5f131a787efcda109e405fe99104626bc912194d (diff)
downloadtxr-116ab6dc94eadc629b118ad618ad4a3145fad6b8.tar.gz
txr-116ab6dc94eadc629b118ad618ad4a3145fad6b8.tar.bz2
txr-116ab6dc94eadc629b118ad618ad4a3145fad6b8.zip
linenoise: deal with some lingering line wrap glitch.
The optimized character insert case must handle the situation of the cursor going off the edge of the screen when a character is output in the last column in a manner that is consistent with the regular insert, leaving the linenoise structure in the same state that a full refresh would. * linenoise/linenoise.c (refresh_multiline): In the optimized character insert case indicated by need_refresh == 2, we must add the check for the cursor being in the dead spot past the edge of the screen, just like we do later in the function for the regular refresh case. In that case we must advance the cursor to the next line to get it out of the dead spot, and adjust maxrows if necessary. We know we are in the dead spot from the two rows values output by screen_rows. That function puts out a nrow value that exceeds rows when that is the case.
Diffstat (limited to 'linenoise')
-rw-r--r--linenoise/linenoise.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c
index 50e44e00..aef49384 100644
--- a/linenoise/linenoise.c
+++ b/linenoise/linenoise.c
@@ -1148,6 +1148,12 @@ static void refresh_multiline(lino_t *l) {
if (l->need_refresh == 2) {
l->oldrow = nrow;
+ if (nrow > rows) {
+ (void) lino_os.puts_fn(l->tty_ofs, L"\r\n");
+ rows++;
+ if (rows > l->maxrows)
+ l->maxrows = rows;
+ }
return;
}