aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-21 14:11:05 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-06-21 14:13:33 +0800
commitf45403db19d888266d1cc04756bfef20a26f9f7f (patch)
treee489e3436ef4da30720292df277ca35dc64cffdd /src
parent86ea42ce265a5a9df2843b04e8036268593825b9 (diff)
downloadrneovim-f45403db19d888266d1cc04756bfef20a26f9f7f.tar.gz
rneovim-f45403db19d888266d1cc04756bfef20a26f9f7f.tar.bz2
rneovim-f45403db19d888266d1cc04756bfef20a26f9f7f.zip
vim-patch:9.1.0511: CursorMovedC triggered wrongly with setcmdpos()
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: vim/vim#15064 https://github.com/vim/vim/commit/bc6f96708e3678dbb27ec4192d87cf94a15d4e9a
Diffstat (limited to 'src')
-rw-r--r--src/nvim/ex_getln.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 8e0378dd68..2e63a139c3 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -134,7 +134,7 @@ typedef struct {
int wim_index; // index in wim_flags[]
int save_msg_scroll;
int save_State; // remember State when called
- int save_cmdspos;
+ int prev_cmdpos;
char *save_p_icm;
int some_key_typed; // one of the keys was typed
// mouse drag and release events are ignored, unless they are
@@ -691,7 +691,7 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear
.indent = indent,
.save_msg_scroll = msg_scroll,
.save_State = State,
- .save_cmdspos = ccline.cmdspos,
+ .prev_cmdpos = -1,
.ignore_drag_release = true,
};
CommandLineState *s = &state;
@@ -2184,10 +2184,10 @@ static int command_line_handle_key(CommandLineState *s)
static int command_line_not_changed(CommandLineState *s)
{
// Trigger CursorMovedC autocommands.
- if (ccline.cmdspos != s->save_cmdspos) {
+ if (ccline.cmdpos != s->prev_cmdpos) {
trigger_cmd_autocmd(get_cmdline_type(), EVENT_CURSORMOVEDC);
+ s->prev_cmdpos = ccline.cmdpos;
}
-
// Incremental searches for "/" and "?":
// Enter command_line_not_changed() when a character has been read but the
// command line did not change. Then we only search and redraw if something
@@ -2662,6 +2662,7 @@ static void do_autocmd_cmdlinechanged(int firstc)
static int command_line_changed(CommandLineState *s)
{
+ s->prev_cmdpos = ccline.cmdpos;
// Trigger CmdlineChanged autocommands.
do_autocmd_cmdlinechanged(s->firstc > 0 ? s->firstc : '-');
@@ -4191,9 +4192,6 @@ static int set_cmdline_pos(int pos)
new_cmdpos = pos;
}
- // Trigger CursorMovedC autocommands.
- trigger_cmd_autocmd(get_cmdline_type(), EVENT_CURSORMOVEDC);
-
return 0;
}