1
0
forked from aniani/vim

patch 9.1.0543: Behavior of CursorMovedC is strange

Problem:  Behavior of CursorMovedC is strange.
Solution: Also trigger when the cmdline has changed.
          (zeertzjq)

fixes: #15069
closes: #15071

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
zeertzjq
2024-07-07 20:48:25 +02:00
committed by Christian Brabandt
parent e85fdc730e
commit 8145620a95
4 changed files with 26 additions and 9 deletions

View File

@@ -2480,13 +2480,13 @@ cmdline_not_changed:
trigger_cmd_autocmd(cmdline_type, EVENT_CURSORMOVEDC);
prev_cmdpos = ccline.cmdpos;
}
#ifdef FEAT_SEARCH_EXTRA
if (!is_state.incsearch_postponed)
continue;
#endif
cmdline_changed:
prev_cmdpos = ccline.cmdpos;
#ifdef FEAT_SEARCH_EXTRA
// If the window changed incremental search state is not valid.
if (is_state.winid != curwin->w_id)
@@ -2496,6 +2496,13 @@ cmdline_changed:
if (trigger_cmdlinechanged)
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
// Trigger CursorMovedC autocommands.
if (ccline.cmdpos != prev_cmdpos)
{
trigger_cmd_autocmd(cmdline_type, EVENT_CURSORMOVEDC);
prev_cmdpos = ccline.cmdpos;
}
#ifdef FEAT_SEARCH_EXTRA
if (xpc.xp_context == EXPAND_NOTHING && (KeyTyped || vpeekc() == NUL))
may_do_incsearch_highlighting(firstc, count, &is_state);