diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-17 13:03:10 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-17 13:51:46 +0800 |
commit | 7e79cb56c5e2ebc34731764c5fa46bebfd5603e2 (patch) | |
tree | a30379c223b74f086cce7b197964b93bdbda53cc /src/nvim/ex_docmd.c | |
parent | 95b1191505a567fd309c16615948479456826c92 (diff) | |
download | rneovim-7e79cb56c5e2ebc34731764c5fa46bebfd5603e2.tar.gz rneovim-7e79cb56c5e2ebc34731764c5fa46bebfd5603e2.tar.bz2 rneovim-7e79cb56c5e2ebc34731764c5fa46bebfd5603e2.zip |
vim-patch:8.2.1294: Vim9: error when using vim9script in TextYankPost
Problem: Vim9: error when using vim9script in TextYankPost.
Solution: Use EX_LOCKOK instead of the EX_CMDWIN flag for command that can
be used when text is locked. (closes vim/vim#6529)
https://github.com/vim/vim/commit/37394ff75270877a032422abcd079a6732a29730
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. |