fix: use async for moving cursor with dot repeat #1904
Draft
+37
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't love this solution in general, so please feel free to suggest other ideas!
We use
<C-g>U<Left>
to move the cursor backwards after accepting with auto-brackets (move_cursor_in_dot_repeat
). However, because we usefeedkeys
, the input is queued for processing, but doesn't get processed until aftervim.schedule
. This means we don't have an easy way to wait for it to finish processing and the downstreamshow_if_on_trigger_character()
will see the cursor attest()|
instead of attest(|)
.I've setup an autocmd that listens for a
CursorMoved/CursorMovedI
event (needCursorMovedC
too, but that's nvim 0.11+. need to test terminal too) and resolves themove_cursor_in_dot_repeat
task when the autocmd fires. Notably, this makes thedefault_implementation
passed tosource:execute
Task
rather thanvoid
, so sources would need to be updated to support this.Closes #1685