patch 9.1.1689: CmdlineChanged not triggered by <Del> Commit: https://github.com/vim/vim/commit/540480697dd8c9a5c97188e8d0bc8f2ac4d751d1 Author: Shougo Matsushita <shougo.ma...@gmail.com> Date: Tue Aug 26 17:36:49 2025 +0200
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.ma...@gmail.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/src/ex_getln.c b/src/ex_getln.c index 289231045..8426f00cb 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -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. diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 43605f7e1..2c976e82d 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -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 diff --git a/src/version.c b/src/version.c index 390959c7e..bedb8ec0b 100644 --- a/src/version.c +++ b/src/version.c @@ -724,6 +724,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1689, /**/ 1688, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1uqvr7-003WWY-9N%40256bit.org.