From faacb12822488d6118f55f02c10887f9d670487c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 28 Jan 2022 23:32:57 -0800 Subject: 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. --- linenoise/linenoise.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'linenoise/linenoise.c') 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; } -- cgit v1.2.3