aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-07 07:21:50 +0800
committerGitHub <noreply@github.com>2022-07-07 07:21:50 +0800
commit5e84db5c90db60f68fe69b3585ba742d1a872b90 (patch)
treece06952a02c3768eba6180dc24d77421176d62ff /src/nvim/ex_getln.c
parent4ffe5d018919d3fbea21e667f09f14b9751f9cd5 (diff)
parentd4db87f4932a3a994cd5364c1cf85f0913a37070 (diff)
downloadrneovim-5e84db5c90db60f68fe69b3585ba742d1a872b90.tar.gz
rneovim-5e84db5c90db60f68fe69b3585ba742d1a872b90.tar.bz2
rneovim-5e84db5c90db60f68fe69b3585ba742d1a872b90.zip
Merge pull request #19261 from zeertzjq/vim-8.2.5023
vim-patch:8.2.{5023,5043,5044}: substitute textlock fixes
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index f322c46bf1..7e22ed55cb 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,9 +6611,9 @@ 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.
// Can't do this recursively. Can't do it when typing a password.
- if (cmdwin_type != 0
- || cmdline_star > 0) {
+ if (text_or_buf_locked() || cmdwin_type != 0 || cmdline_star > 0) {
beep_flush();
return K_IGNORE;
}