summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--linenoise/linenoise.c8
-rw-r--r--parser.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c
index b905d444..15d919b8 100644
--- a/linenoise/linenoise.c
+++ b/linenoise/linenoise.c
@@ -635,10 +635,8 @@ static int complete_line(lino_t *ls, int substring) {
free_completions(&lc);
lino_os.free_fn(lt);
ls->error = (lino_os.eof_fn(ls->tty_ifs) ? lino_eof : lino_ioerr);
- return -1;
- }
-
- switch (c) {
+ stop = 1;
+ } else switch (c) {
case TAB:
i = (i+1) % (lc.len+1);
if (i == lc.len) generate_beep(ls);
@@ -751,6 +749,7 @@ static int history_search(lino_t *l)
handle_resize(lc, l);
continue;
}
+ lc->error = (lino_os.eof_fn(lc->tty_ifs) ? lino_eof : lino_ioerr);
stop = 1;
} else {
if (vb)
@@ -2120,6 +2119,7 @@ static int edit(lino_t *l, const wchar_t *prompt)
if (c == WEOF) {
ret = l->len ? l->len : -1;
+ l->error = (lino_os.eof_fn(l->tty_ifs) ? lino_eof : lino_ioerr);
goto out;
}
diff --git a/parser.c b/parser.c
index df37232f..0237d12f 100644
--- a/parser.c
+++ b/parser.c
@@ -1769,6 +1769,8 @@ val repl(val bindings, val in_stream, val out_stream, val env)
uw_push_handler(&uw_handler, cons(warning_s, nil), rw_f);
+ clear_error(in_stream);
+
line_w = linenoise(ls, c_str(prompt, self));
uw_pop_frame(&uw_handler);