Mercurial > vim
diff src/ex_getln.c @ 20229:06a1dd50463e v8.2.0670
patch 8.2.0670: cannot change window when evaluating 'completefunc'
Commit: https://github.com/vim/vim/commit/6adb9ea0a6ca01414f4b591f379b0f829a8273c0
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Apr 30 22:31:18 2020 +0200
patch 8.2.0670: cannot change window when evaluating 'completefunc'
Problem: Cannot change window when evaluating 'completefunc'.
Solution: Make a difference between not changing text or buffers and also
not changing window.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 30 Apr 2020 22:45:04 +0200 |
parents | 8d9229c4781a |
children | abebcc20af26 |
line wrap: on
line diff
--- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1318,12 +1318,12 @@ getcmdline_int( c = get_expr_register(); if (c == '=') { - // Need to save and restore ccline. And set "textlock" + // Need to save and restore ccline. And set "textwinlock" // to avoid nasty things like going to another buffer when // evaluating an expression. - ++textlock; + ++textwinlock; p = get_expr_line(); - --textlock; + --textwinlock; if (p != NULL) { @@ -2548,17 +2548,17 @@ check_opt_wim(void) /* * Return TRUE when the text must not be changed and we can't switch to - * another window or buffer. Used when editing the command line, evaluating + * another window or buffer. TRUE when editing the command line, evaluating * 'balloonexpr', etc. */ int -text_locked(void) +text_and_win_locked(void) { #ifdef FEAT_CMDWIN if (cmdwin_type != 0) return TRUE; #endif - return textlock != 0; + return textwinlock != 0; } /* @@ -2578,10 +2578,22 @@ get_text_locked_msg(void) if (cmdwin_type != 0) return e_cmdwin; #endif + if (textwinlock != 0) + return e_textwinlock; return e_textlock; } /* + * Return TRUE when the text must not be changed and/or we cannot switch to + * another window. TRUE while evaluating 'completefunc'. + */ + int +text_locked(void) +{ + return text_and_win_locked() || textlock != 0; +} + +/* * Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is * and give an error message. */ @@ -3560,11 +3572,11 @@ cmdline_paste( regname = may_get_selection(regname); #endif - // Need to set "textlock" to avoid nasty things like going to another + // Need to set "textwinlock" to avoid nasty things like going to another // buffer when evaluating an expression. - ++textlock; + ++textwinlock; i = get_spec_reg(regname, &arg, &allocated, TRUE); - --textlock; + --textwinlock; if (i) {