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>
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 3444a0e..481b450 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1586,6 +1586,7 @@
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 @@
* (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 @@
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 @@
new_cmdpos = 0;
else
new_cmdpos = pos;
+
+ // Trigger CursorMovedC autocommands.
+ trigger_cmd_autocmd(get_cmdline_type(), EVENT_CURSORMOVEDC);
+
return 0;
}