summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-01-28 23:32:57 -0800
committerKaz Kylheku <kaz@kylheku.com>2022-01-28 23:32:57 -0800
commitfaacb12822488d6118f55f02c10887f9d670487c (patch)
treea64439b727926f85ecdef77f3e51fe7fba305286
parent499708ec41e69fefdfee1f9db1bbcfbc7db5b87f (diff)
downloadtxr-faacb12822488d6118f55f02c10887f9d670487c.tar.gz
txr-faacb12822488d6118f55f02c10887f9d670487c.tar.bz2
txr-faacb12822488d6118f55f02c10887f9d670487c.zip
linenoise: issue newline on EOF in plain mode.
* linenoise/linenoise.c (linenoise): In plain mode, like in full editing mode, when EOF is detected, print a newline so that when TXR exit to an interactive shell, the shell's prompt starts on a new line.
-rw-r--r--linenoise/linenoise.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c
index e783a2f5..920c45d9 100644
--- a/linenoise/linenoise.c
+++ b/linenoise/linenoise.c
@@ -2606,6 +2606,8 @@ wchar_t *linenoise(lino_t *ls, const wchar_t *prompt)
/* Not a tty: read from file / pipe. */
if (lino_os.getl_fn(ls->tty_ifs, ls->data, nelem(ls->data)) == 0) {
ls->error = (lino_os.eof_fn(ls->tty_ifs) ? lino_eof : lino_ioerr);
+ if (!lino_os.puts_fn(ls->tty_ofs, L"\n"))
+ ls->error = lino_ioerr;
break;
}