diff options
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index f322c46bf1..51085c4fa0 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -2726,6 +2726,17 @@ char *get_text_locked_msg(void) } } +/// Check for text, window or buffer locked. +/// Give an error message and return true if something is locked. +bool text_or_buf_locked(void) +{ + if (text_locked()) { + text_locked_msg(); + return true; + } + return curbuf_locked(); +} + /// Check if "curbuf->b_ro_locked" or "allbuf_lock" is set and /// return true when it is and give an error message. bool curbuf_locked(void) @@ -6600,6 +6611,11 @@ static int open_cmdwin(void) bool save_exmode = exmode_active; int save_cmdmsg_rl = cmdmsg_rl; + // 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 || cmdline_star > 0) { |