From dfc33a665d3b12689aa971575b8e7de4e5202d83 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 29 Apr 2020 22:30:13 +0200 Subject: patch 8.2.0662: cannot use input() in a channel callback Problem: Cannot use input() in a channel callback. Solution: Reset vgetc_busy. (closes #6010) --- src/ex_getln.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/ex_getln.c') diff --git a/src/ex_getln.c b/src/ex_getln.c index 7e92ec8992..6376a5fba4 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4468,6 +4468,8 @@ get_user_input( rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; + if (input_busy) + return; // this doesn't work recursively. #ifdef NO_CONSOLE_INPUT // While starting up, there is no place to enter text. When running tests @@ -4528,12 +4530,18 @@ get_user_input( if (defstr != NULL) { int save_ex_normal_busy = ex_normal_busy; + int save_vgetc_busy = vgetc_busy; + int save_input_busy = input_busy; + input_busy |= vgetc_busy; ex_normal_busy = 0; + vgetc_busy = 0; rettv->vval.v_string = getcmdline_prompt(secret ? NUL : '@', p, get_echo_attr(), xp_type, xp_arg); ex_normal_busy = save_ex_normal_busy; + vgetc_busy = save_vgetc_busy; + input_busy = save_input_busy; } if (inputdialog && rettv->vval.v_string == NULL && argvars[1].v_type != VAR_UNKNOWN -- cgit v1.2.3