aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_getln.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-07-08 06:55:21 +0800
committerGitHub <noreply@github.com>2024-07-08 06:55:21 +0800
commit76b91106fc836ae634cdf8425d121d843d14d70a (patch)
tree7f7583c4f7e0f2048650c3e2e5b9346922d0d2a4 /src/nvim/ex_getln.c
parent055a222797e46a046a365707e4e0dc957e46c648 (diff)
downloadrneovim-76b91106fc836ae634cdf8425d121d843d14d70a.tar.gz
rneovim-76b91106fc836ae634cdf8425d121d843d14d70a.tar.bz2
rneovim-76b91106fc836ae634cdf8425d121d843d14d70a.zip
vim-patch:9.1.0543: Behavior of CursorMovedC is strange (#29608)
Problem: Behavior of CursorMovedC is strange. Solution: Also trigger when the cmdline has changed. (zeertzjq) fixes: vim/vim#15069 closes: vim/vim#15071 https://github.com/vim/vim/commit/8145620a958dbb5c82cf8f8a37556ee1ea501c6d
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r--src/nvim/ex_getln.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 2e63a139c3..e3c7008d3b 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2188,6 +2188,7 @@ static int command_line_not_changed(CommandLineState *s)
trigger_cmd_autocmd(get_cmdline_type(), EVENT_CURSORMOVEDC);
s->prev_cmdpos = ccline.cmdpos;
}
+
// Incremental searches for "/" and "?":
// Enter command_line_not_changed() when a character has been read but the
// command line did not change. Then we only search and redraw if something
@@ -2662,10 +2663,15 @@ static void do_autocmd_cmdlinechanged(int firstc)
static int command_line_changed(CommandLineState *s)
{
- s->prev_cmdpos = ccline.cmdpos;
// Trigger CmdlineChanged autocommands.
do_autocmd_cmdlinechanged(s->firstc > 0 ? s->firstc : '-');
+ // Trigger CursorMovedC autocommands.
+ if (ccline.cmdpos != s->prev_cmdpos) {
+ trigger_cmd_autocmd(get_cmdline_type(), EVENT_CURSORMOVEDC);
+ s->prev_cmdpos = ccline.cmdpos;
+ }
+
const bool prev_cmdpreview = cmdpreview;
if (s->firstc == ':'
&& current_sctx.sc_sid == 0 // only if interactive