zed/crates/vim/test_data/test_dot_repeat.json
Fanteria 80a4042ff5
vim: Fix dot repeat after macro replay not capturing insertion text (#57684)
Closes #47251

Fix dot (`.`) repeat not correctly repeating the last change after
replaying a macro (`@register`)
([#47251](https://github.com/zed-industries/zed/issues/47251))

When replaying a macro that contains text insertions,
`replay_insert_event` calls `handle_input` directly and never emits
`InputHandled`, so the `observe_insertion` subscription never fires.
This left the dot register stale — `.` after `@register` would repeat an
earlier change instead of the last one made by the macro.

Fix by calling `observe_insertion` explicitly in the
`ReplayableAction::Insertion` branch of `Replayer::next`.

Release Notes:

- Fixed dot (`.`) repeat not repeating the last change made by a macro
(`@register`).

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-05-27 14:36:41 +00:00

60 lines
1.2 KiB
JSON

{"Put":{"state":"ˇhello"}}
{"Key":"o"}
{"Key":"w"}
{"Key":"o"}
{"Key":"r"}
{"Key":"l"}
{"Key":"d"}
{"Key":"escape"}
{"Get":{"state":"hello\nworlˇd","mode":"Normal"}}
{"Key":"."}
{"Get":{"state":"hello\nworld\nworlˇd","mode":"Normal"}}
{"Key":"^"}
{"Key":"d"}
{"Key":"f"}
{"Key":"o"}
{"Key":"g"}
{"Key":"g"}
{"Key":"."}
{"Get":{"state":"ˇ\nworld\nrld","mode":"Normal"}}
{"Key":"j"}
{"Key":"y"}
{"Key":"y"}
{"Key":"p"}
{"Key":"shift-g"}
{"Key":"y"}
{"Key":"y"}
{"Key":"."}
{"Get":{"state":"\nworld\nworld\nrld\nˇrld","mode":"Normal"}}
{"Put":{"state":"ˇthe quick brown fox"}}
{"Key":"2"}
{"Key":"~"}
{"Key":"."}
{"Put":{"state":"THE ˇquick brown fox"}}
{"Key":"3"}
{"Key":"."}
{"Put":{"state":"THE QUIˇck brown fox"}}
{"Key":"."}
{"Get":{"state":"THE QUICK ˇbrown fox","mode":"Normal"}}
{"Put":{"state":"ˇ"}}
{"Key":"q"}
{"Key":"l"}
{"Key":"shift-o"}
{"Key":"h"}
{"Key":"e"}
{"Key":"l"}
{"Key":"l"}
{"Key":"o"}
{"Key":"space"}
{"Key":"w"}
{"Key":"o"}
{"Key":"r"}
{"Key":"l"}
{"Key":"d"}
{"Key":"escape"}
{"Key":"q"}
{"Key":"@"}
{"Key":"l"}
{"Get":{"state":"hello worlˇd\nhello world\n","mode":"Normal"}}
{"Key":"."}
{"Get":{"state":"hello worlˇd\nhello world\nhello world\n","mode":"Normal"}}