From f7e9981975a28b36ae30340e11f3b79abd31e8b0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 7 Sep 2017 06:28:18 -0700 Subject: linenoise: bugfix: cancel extended mode on Enter. * linenoise/linenoise.c (edit): If Enter is processed while in Ctrl-X extended command mode, that mode must be explicitly canceled by resetting the extended local flag. Not doing this became an issue when the Enter callback mechanism was introduced to detect incomplete lines. At that point, entering Ctrl-X Enter on an incomplete line caused linenoise to insert a newline, but stay in extended mode. --- linenoise/linenoise.c | 1 + 1 file changed, 1 insertion(+) (limited to 'linenoise') diff --git a/linenoise/linenoise.c b/linenoise/linenoise.c index a3c83e66..a80ca3ab 100644 --- a/linenoise/linenoise.c +++ b/linenoise/linenoise.c @@ -2015,6 +2015,7 @@ static int edit(lino_t *l, const char *prompt) } break; case ENTER: + extended = 0; if (l->mlmode && l->enter_callback && !l->enter_callback(l->data, l->ce_ctx)) { -- cgit v1.2.3