vim: Fix bug where d . . freezes the editor (#42145)

This bug seems to be caused by pushing an operator (i.e. `d`) followed
by a repeat (i.e. `.`) so the recording includes the push operator and
the repeat. When this is repeated (i.e. `.`) it causes an infinite loop.

This change fixes this bug by pushing a ClearOperator action if there is
an ongoing recording when repeat is called.

Release Notes:

- Fixed bug where pressing `d . .` in Vim mode would freeze the editor.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
This commit is contained in:
AidanV
2025-11-24 16:55:19 +00:00
committed by GitHub
co-authored by dino
parent 47e8946581
commit 4a36f67f94
5 changed files with 134 additions and 3 deletions
@@ -0,0 +1,21 @@
{"Put":{"state":"ˇthe quick brown\nfox jumps over\nthe lazy dog"}}
{"Key":"d"}
{"Key":"d"}
{"Get":{"state":"ˇfox jumps over\nthe lazy dog","mode":"Normal"}}
{"Key":"2"}
{"Key":"d"}
{"Key":"."}
{"Get":{"state":"ˇfox jumps over\nthe lazy dog","mode":"Normal"}}
{"Key":"."}
{"Get":{"state":"ˇthe lazy dog","mode":"Normal"}}
{"Put":{"state":"ˇthe quick brown\nfox jumps over\nthe lazy dog\nthe quick brown\nfox jumps over\nthe lazy dog"}}
{"Key":"2"}
{"Key":"d"}
{"Key":"d"}
{"Get":{"state":"ˇthe lazy dog\nthe quick brown\nfox jumps over\nthe lazy dog","mode":"Normal"}}
{"Key":"5"}
{"Key":"d"}
{"Key":"."}
{"Get":{"state":"ˇthe lazy dog\nthe quick brown\nfox jumps over\nthe lazy dog","mode":"Normal"}}
{"Key":"."}
{"Get":{"state":"ˇfox jumps over\nthe lazy dog","mode":"Normal"}}
@@ -0,0 +1,8 @@
{"Put":{"state":"ˇthe quick brown\nfox jumps over\nthe lazy dog"}}
{"Key":"d"}
{"Key":"d"}
{"Get":{"state":"ˇfox jumps over\nthe lazy dog","mode":"Normal"}}
{"Key":"d"}
{"Key":"."}
{"Key":"."}
{"Get":{"state":"ˇthe lazy dog","mode":"Normal"}}