diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-29 21:07:07 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-29 21:07:07 +0100 |
commit | 28976e2accf11591c60e8a658a9e03544f0408b2 (patch) | |
tree | 5e0ad5064936b05fd30e1eb7c946d8afeaf848b3 /src/insexpand.c | |
parent | df2c2988bbaecd28b0fbec8d64327b1bbb005e19 (diff) | |
download | vim-git-28976e2accf11591c60e8a658a9e03544f0408b2.tar.gz |
patch 8.2.2426: allowing 'completefunc' to switch windows causes troublev8.2.2426
Problem: Allowing 'completefunc' to switch windows causes trouble.
Solution: use "textwinlock" instead of "textlock".
Diffstat (limited to 'src/insexpand.c')
-rw-r--r-- | src/insexpand.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/insexpand.c b/src/insexpand.c index 02f593d7c..66507f043 100644 --- a/src/insexpand.c +++ b/src/insexpand.c @@ -2218,9 +2218,10 @@ expand_by_function( pos = curwin->w_cursor; curwin_save = curwin; curbuf_save = curbuf; - // Lock the text to avoid weird things from happening. Do allow switching - // to another window temporarily. - ++textlock; + // Lock the text to avoid weird things from happening. Also disallow + // switching to another window, it should not be needed and may end up in + // Insert mode in another buffer. + ++textwinlock; // Call a function, which returns a list or dict. if (call_vim_function(funcname, 2, args, &rettv) == OK) @@ -2243,7 +2244,7 @@ expand_by_function( break; } } - --textlock; + --textwinlock; if (curwin_save != curwin || curbuf_save != curbuf) { @@ -3226,7 +3227,7 @@ ins_compl_next( return -1; if (compl_leader != NULL - && (compl_shown_match->cp_flags & CP_ORIGINAL_TEXT) == 0) + && (compl_shown_match->cp_flags & CP_ORIGINAL_TEXT) == 0) { // Set "compl_shown_match" to the actually shown match, it may differ // when "compl_leader" is used to omit some of the matches. |