vim: Fix dot repeat after replaying a macro#57698
Open
Liberxue wants to merge 1 commit into
Open
Conversation
Replaying a macro via @<reg> dispatches actions through Replayer, but its Insertion branch writes the buffer with replay_insert_event, which bypasses the InputHandled event that feeds observe_insertion. The dot-recording started by the replayed InsertBefore therefore sealed an empty insertion into recorded_actions, so `.` after @<reg> only re-entered and exited insert mode without inserting any text. Add observe_replayed_insertion that feeds the dot-recording stream only, and call it from Replayer::next after each replayed insertion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Replaying a macro via
@<reg>dispatches actions throughReplayer, but itsInsertionbranch writes the buffer withreplay_insert_event, which bypasses theInputHandledevent that feedsobserve_insertion. The dot-recording started by the replayedInsertBeforetherefore sealed an empty insertion intorecorded_actions, so pressing.after@<reg>only re-entered and exited insert mode without inserting any text.Add
observe_replayed_insertionthat feeds the dot-recording stream only, and call it fromReplayer::nextafter each replayed insertion. The existing dot-recording machinery then captures the last change inside the macro, matching Vim's.semantics for both single- and multi-change macros.Self-Review Checklist:
Closes #47251
Release Notes:
.not repeating after replaying a macro with@<reg>in vim modeexamples :
20260526-examples.mp4