summaryrefslogtreecommitdiffstats
path: root/src/insexpand.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-04-30 22:31:18 +0200
committerBram Moolenaar <Bram@vim.org>2020-04-30 22:31:18 +0200
commit6adb9ea0a6ca01414f4b591f379b0f829a8273c0 (patch)
tree8af9e5e5b2ea5d0a76e0fb1b393835c46674b27f /src/insexpand.c
parent4e5534fab798ab7c95554da3bc80b08336aedc2b (diff)
patch 8.2.0670: cannot change window when evaluating 'completefunc'v8.2.0670
Problem: Cannot change window when evaluating 'completefunc'. Solution: Make a difference between not changing text or buffers and also not changing window.
Diffstat (limited to 'src/insexpand.c')
-rw-r--r--src/insexpand.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/insexpand.c b/src/insexpand.c
index 48ab260a70..bd809b0e6f 100644
--- a/src/insexpand.c
+++ b/src/insexpand.c
@@ -989,9 +989,9 @@ trigger_complete_changed_event(int cur)
dict_set_items_ro(v_event);
recursive = TRUE;
- textlock++;
+ textwinlock++;
apply_autocmds(EVENT_COMPLETECHANGED, NULL, NULL, FALSE, curbuf);
- textlock--;
+ textwinlock--;
recursive = FALSE;
dict_free_contents(v_event);
@@ -2217,7 +2217,8 @@ expand_by_function(
pos = curwin->w_cursor;
curwin_save = curwin;
curbuf_save = curbuf;
- // Lock the text to avoid weird things from happening.
+ // Lock the text to avoid weird things from happening. Do allow switching
+ // to another window temporarily.
++textlock;
// Call a function, which returns a list or dict.
@@ -2442,8 +2443,8 @@ f_complete(typval_T *argvars, typval_T *rettv UNUSED)
return;
}
- // "textlock" is set when evaluating 'completefunc' but we can change text
- // here.
+ // "textlock" is set when evaluating 'completefunc' but we can change
+ // text here.
textlock = 0;
// Check for undo allowed here, because if something was already inserted