summaryrefslogtreecommitdiff
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-30 15:23:09 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-30 15:23:09 +0100
commit71223e2db87c2bf3b09aecb46266b56cda26191d (patch)
tree3fc0857560f746c12af92b0ed02e2aab8696708e /src/ex_getln.c
parent89b25585ccecf223ca41ca212df8ebc227fc035a (diff)
downloadvim-git-71223e2db87c2bf3b09aecb46266b56cda26191d.tar.gz
patch 8.2.5043: can open a cmdline window from a substitute expressionv8.2.5043
Problem: Can open a cmdline window from a substitute expression. Solution: Disallow opening a command line window when text or buffer is locked.
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 9dadfbf2f..623bd1d49 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -2740,6 +2740,21 @@ get_text_locked_msg(void)
}
/*
+ * 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)