+14
-0
lines changedFilter options
+14
-0
lines changed Original file line number Diff line number Diff line change
@@ -932,6 +932,12 @@ static int do_autocmd_event(event_T event, char_u *pat, bool once, int nested, c
932
932
last_mode = get_mode();
933
933
}
934
934
935
+
// If the event is CursorMoved, update the last cursor position
936
+
// position to avoid immediately triggering the autocommand
937
+
if (event == EVENT_CURSORMOVED && !has_event(EVENT_CURSORMOVED)) {
938
+
curwin->w_last_cursormoved = curwin->w_cursor;
939
+
}
940
+
935
941
ap->cmds = NULL;
936
942
*prev_ap = ap;
937
943
last_autopat[(int)event] = ap;
Original file line number Diff line number Diff line change
@@ -31,4 +31,12 @@ describe('CursorMoved', function()
31
31
eq({'aaa'}, funcs.nvim_buf_get_lines(eval('g:buf'), 0, -1, true))
32
32
eq(0, eval('g:cursormoved'))
33
33
end)
34
+
35
+
it("is not triggered by cursor movement prior to first CursorMoved instantiation", function()
36
+
source([[
37
+
let g:cursormoved = 0
38
+
autocmd CursorMoved * let g:cursormoved += 1
39
+
]])
40
+
eq(0, eval('g:cursormoved'))
41
+
end)
34
42
end)
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4