diff src/ex_getln.c @ 20213:8d9229c4781a v8.2.0662

patch 8.2.0662: cannot use input() in a channel callback Commit: https://github.com/vim/vim/commit/dfc33a665d3b12689aa971575b8e7de4e5202d83 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 29 22:30:13 2020 +0200 patch 8.2.0662: cannot use input() in a channel callback Problem: Cannot use input() in a channel callback. Solution: Reset vgetc_busy. (closes https://github.com/vim/vim/issues/6010)
author Bram Moolenaar <Bram@vim.org>
date Wed, 29 Apr 2020 22:45:04 +0200
parents 2dd1ac2c48f4
children 06a1dd50463e
line wrap: on
line diff
--- 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