0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.1.0507: hard to detect cursor movement in the command line

Problem:  hard to detect cursor movement in the command line
Solution: Add the CursorMovedC autocommand
          (Shougo Matsushita)

closes: #15040

Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Shougo Matsushita
2024-06-20 22:05:16 +02:00
committed by Christian Brabandt
parent beb02ed674
commit d09521476f
8 changed files with 42 additions and 3 deletions

View File

@@ -1586,6 +1586,7 @@ getcmdline_int(
int res;
int save_msg_scroll = msg_scroll;
int save_State = State; // remember State when called
int save_cmdspos = ccline.cmdspos;
int some_key_typed = FALSE; // one of the keys was typed
// mouse drag and release events are ignored, unless they are
// preceded with a mouse down event
@@ -2473,6 +2474,10 @@ getcmdline_int(
* (Sorry for the goto's, I know it is ugly).
*/
cmdline_not_changed:
// Trigger CursorMovedC autocommands.
if (ccline.cmdspos != save_cmdspos)
trigger_cmd_autocmd(cmdline_type, EVENT_CURSORMOVEDC);
#ifdef FEAT_SEARCH_EXTRA
if (!is_state.incsearch_postponed)
continue;
@@ -2484,8 +2489,8 @@ cmdline_changed:
if (is_state.winid != curwin->w_id)
init_incsearch_state(&is_state);
#endif
// Trigger CmdlineChanged autocommands.
if (trigger_cmdlinechanged)
// Trigger CmdlineChanged autocommands.
trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED);
#ifdef FEAT_SEARCH_EXTRA
@@ -4315,6 +4320,10 @@ set_cmdline_pos(
new_cmdpos = 0;
else
new_cmdpos = pos;
// Trigger CursorMovedC autocommands.
trigger_cmd_autocmd(get_cmdline_type(), EVENT_CURSORMOVEDC);
return 0;
}