0
0
mirror of https://github.com/vim/vim.git synced 2025-10-21 08:24:06 -04:00

patch 9.1.1689: CmdlineChanged not triggered by <Del>

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

closes: #18101

Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Shougo Matsushita
2025-08-26 17:36:49 +02:00
committed by Christian Brabandt
parent a19b019b87
commit 540480697d
3 changed files with 16 additions and 3 deletions

View File

@@ -1855,7 +1855,7 @@ getcmdline_int(
if (ccline.cmdbuff != NULL)
{
prev_cmdbuff = vim_strnsave(ccline.cmdbuff, ccline.cmdpos);
prev_cmdbuff = vim_strsave(ccline.cmdbuff);
if (prev_cmdbuff == NULL)
goto returncmd;
}
@@ -2622,8 +2622,8 @@ cmdline_changed:
// Trigger CmdlineChanged autocommands.
if (trigger_cmdlinechanged
&& (ccline.cmdpos != prev_cmdpos
|| (prev_cmdbuff != NULL && STRNCMP(prev_cmdbuff,
ccline.cmdbuff, prev_cmdpos) != 0)))
|| (prev_cmdbuff != NULL &&
STRCMP(prev_cmdbuff, ccline.cmdbuff) != 0)))
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
// Trigger CursorMovedC autocommands.

View File

@@ -2183,6 +2183,17 @@ func Test_Cmdline()
\ '0abc1abc2abc3',
\ ], g:log)
" <Del> should trigger CmdlineChanged
let g:log = []
call feedkeys(":foo\<Left>\<Left>\<Del>\<Del>\<Esc>", 'xt')
call assert_equal([
\ 'f',
\ 'fo',
\ 'foo',
\ 'fo',
\ 'f',
\ ], g:log)
unlet g:log
au! CmdlineChanged

View File

@@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1689,
/**/
1688,
/**/