summaryrefslogtreecommitdiffstats
path: root/src/ex_getln.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-21 07:51:40 +0200
committerChristian Brabandt <cb@256bit.org>2024-06-21 07:51:40 +0200
commitbc6f96708e3678dbb27ec4192d87cf94a15d4e9a (patch)
treea28909aae0f2fea8f7e751fbb3acbdccf1fd4226 /src/ex_getln.c
parent17e0a1969da4e70771435fc7fa9d8c96d25c8b00 (diff)
patch 9.1.0511: CursorMovedC triggered wrongly with setcmdpos()v9.1.0511
Problem: CursorMovedC triggered wrongly with setcmdpos() (after v9.1.0507) Solution: Remove the premature triggering. Also don't trigger when cursor didn't move. (zeertzjq) closes: #15064 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/ex_getln.c')
-rw-r--r--src/ex_getln.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c
index 481b450dc1..f05259bb9d 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -1586,7 +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 prev_cmdpos = -1;
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
@@ -2474,16 +2474,19 @@ getcmdline_int(
* (Sorry for the goto's, I know it is ugly).
*/
cmdline_not_changed:
- // Trigger CursorMovedC autocommands.
- if (ccline.cmdspos != save_cmdspos)
+ // Trigger CursorMovedC autocommands.
+ if (ccline.cmdpos != prev_cmdpos)
+ {
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)
@@ -4321,9 +4324,6 @@ set_cmdline_pos(
else
new_cmdpos = pos;
- // Trigger CursorMovedC autocommands.
- trigger_cmd_autocmd(get_cmdline_type(), EVENT_CURSORMOVEDC);
-
return 0;
}