vim-patch:9.1.1689: CmdlineChanged not triggered by <Del> (#35496)

Problem:  CmdlineChanged not triggered by <Del>
Solution: Use STRCMP() instead of STRNCMP()
          (Shougo Matsushita)

closes: vim/vim#18101

540480697d

Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
This commit is contained in:
zeertzjq
2025-08-27 10:16:44 +08:00
committed by GitHub
parent 8f78591f9a
commit c741927883
2 changed files with 13 additions and 3 deletions

View File

@@ -1033,7 +1033,7 @@ static int command_line_check(VimState *state)
// cause the command not to be executed.
if (ccline.cmdbuff != NULL) {
s->prev_cmdbuff = xmemdupz(ccline.cmdbuff, (size_t)ccline.cmdpos);
s->prev_cmdbuff = xstrdup(ccline.cmdbuff);
}
// Trigger SafeState if nothing is pending.
@@ -2827,8 +2827,7 @@ static int command_line_changed(CommandLineState *s)
}
if (ccline.cmdpos != s->prev_cmdpos
|| (s->prev_cmdbuff != NULL
&& strncmp(s->prev_cmdbuff, ccline.cmdbuff, (size_t)s->prev_cmdpos) != 0)) {
|| (s->prev_cmdbuff != NULL && strcmp(s->prev_cmdbuff, ccline.cmdbuff) != 0)) {
// Trigger CmdlineChanged autocommands.
do_autocmd_cmdlinechanged(s->firstc > 0 ? s->firstc : '-');
}