0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.5043: can open a cmdline window from a substitute expression

Problem:    Can open a cmdline window from a substitute expression.
Solution:   Disallow opening a command line window when text or buffer is
            locked.
This commit is contained in:
Bram Moolenaar
2022-05-30 15:23:09 +01:00
parent 89b25585cc
commit 71223e2db8
6 changed files with 51 additions and 12 deletions

View File

@@ -2739,6 +2739,21 @@ get_text_locked_msg(void)
return e_not_allowed_to_change_text_or_change_window;
}
/*
* Check for text, window or buffer locked.
* Give an error message and return TRUE if something is locked.
*/
int
text_or_buf_locked(void)
{
if (text_locked())
{
text_locked_msg();
return TRUE;
}
return curbuf_locked();
}
/*
* Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
* and give an error message.
@@ -4379,6 +4394,10 @@ open_cmdwin(void)
int save_KeyTyped;
#endif
// Can't do this when text or buffer is locked.
if (text_or_buf_locked())
return K_IGNORE;
// Can't do this recursively. Can't do it when typing a password.
if (cmdwin_type != 0
# if defined(FEAT_CRYPT) || defined(FEAT_EVAL)