diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-17 14:15:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-17 14:15:32 +0800 |
commit | 9e7f92e59a7fbbc0e266700db1f25278eb30cb2a (patch) | |
tree | e378e7e6d6ba2e4678d92b28c2a67f4930e5a607 /src/nvim/ex_docmd.c | |
parent | 53c398d8f44f1796c216402c953512eb57733529 (diff) | |
parent | 006334f3a7014d5d23df617ed619377464d4956f (diff) | |
download | rneovim-9e7f92e59a7fbbc0e266700db1f25278eb30cb2a.tar.gz rneovim-9e7f92e59a7fbbc0e266700db1f25278eb30cb2a.tar.bz2 rneovim-9e7f92e59a7fbbc0e266700db1f25278eb30cb2a.zip |
Merge pull request #19404 from zeertzjq/vim-8.2.0670
vim-patch:8.2.{0670,0698,1294,1984,2424,2426,2427,5029}: textlock patches
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index c5f393e2ce..c4d2821e79 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -1590,9 +1590,15 @@ int execute_cmd(exarg_T *eap, CmdParseInfo *cmdinfo, bool preview) && !(curbuf->terminal && eap->cmdidx == CMD_put)) { ERROR(_(e_modifiable)); } - if (text_locked() && !(eap->argt & EX_CMDWIN) - && !IS_USER_CMDIDX(eap->cmdidx)) { - ERROR(_(get_text_locked_msg())); + if (!IS_USER_CMDIDX(eap->cmdidx)) { + if (cmdwin_type != 0 && !(eap->argt & EX_CMDWIN)) { + // Command not allowed in the command line window + ERROR(_(e_cmdwin)); + } + if (text_locked() && !(eap->argt & EX_LOCK_OK)) { + // Command not allowed when text is locked + ERROR(_(get_text_locked_msg())); + } } // Disallow editing another buffer when "curbuf->b_ro_locked" is set. // Do allow ":checktime" (it is postponed). @@ -1967,11 +1973,17 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter goto doend; } - if (text_locked() && !(ea.argt & EX_CMDWIN) - && !IS_USER_CMDIDX(ea.cmdidx)) { - // Command not allowed when editing the command line. - errormsg = _(get_text_locked_msg()); - goto doend; + if (!IS_USER_CMDIDX(ea.cmdidx)) { + if (cmdwin_type != 0 && !(ea.argt & EX_CMDWIN)) { + // Command not allowed in the command line window + errormsg = _(e_cmdwin); + goto doend; + } + if (text_locked() && !(ea.argt & EX_LOCK_OK)) { + // Command not allowed when text is locked + errormsg = _(get_text_locked_msg()); + goto doend; + } } // Disallow editing another buffer when "curbuf->b_ro_locked" is set. |