summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2024-06-20 22:05:16 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-20 22:05:16 +0200
commitd09521476f41dd8dbddb25b7acd0b299f9bf94d3 (patch)
treee0228de6da48415951831957367a96b7aff07636 /src/ex_getln.c
parentbeb02ed674bc61f179c4ff71e93bdeeb44fe9c4e (diff)
patch 9.1.0507: hard to detect cursor movement in the command linev9.1.0507
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>
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 3444a0e86e..481b450dc1 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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;
}