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)
37394ff752
This commit is contained in:
zeertzjq
2022-07-17 13:03:10 +08:00
parent 95b1191505
commit 7e79cb56c5
3 changed files with 329 additions and 315 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -57,11 +57,12 @@
#define EX_BUFUNL 0x10000 // accepts unlisted buffer too
#define EX_ARGOPT 0x20000 // allow "++opt=val" argument
#define EX_SBOXOK 0x40000 // allowed in the sandbox
#define EX_CMDWIN 0x80000 // allowed in cmdline window; when missing
// disallows editing another buffer when
// current buffer is locked
#define EX_CMDWIN 0x80000 // allowed in cmdline window
#define EX_MODIFY 0x100000 // forbidden in non-'modifiable' buffer
#define EX_FLAGS 0x200000 // allow flags after count in argument
#define EX_LOCK_OK 0x1000000 // command can be executed when textlock is
// set; when missing disallows editing another
// buffer when current buffer is locked
#define EX_KEEPSCRIPT 0x4000000 // keep sctx of where command was invoked
#define EX_PREVIEW 0x8000000 // allow incremental command preview
#define EX_FILES (EX_XFILE | EX_EXTRA) // multiple extra files allowed

View File

@@ -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.