Fix undo in replace mode (#10086)

Fixes: #10031

Co-Authored-By: Petros <petros@amignosis.com>

Release Notes:

- vim: Fix undo grouping in Replace mode
([#10031](https://github.com/zed-industries/zed/issues/10031)).

---------

Co-authored-by: Petros <petros@amignosis.com>
This commit is contained in:
Conrad Irwin 2024-04-03 11:35:04 -06:00 committed by GitHub
parent 49c53bc0ec
commit fc08ea9b0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View file

@ -390,7 +390,7 @@ impl Vim {
{
visual_block_motion(true, editor, cx, |_, point, goal| Some((point, goal)))
}
if last_mode == Mode::Insert {
if last_mode == Mode::Insert || last_mode == Mode::Replace {
if let Some(prior_tx) = prior_tx {
editor.group_until_transaction(prior_tx, cx)
}
@ -502,7 +502,9 @@ impl Vim {
fn transaction_begun(&mut self, transaction_id: TransactionId, _: &mut WindowContext) {
self.update_state(|state| {
let mode = if (state.mode == Mode::Insert || state.mode == Mode::Normal)
let mode = if (state.mode == Mode::Insert
|| state.mode == Mode::Replace
|| state.mode == Mode::Normal)
&& state.current_tx.is_none()
{
state.current_tx = Some(transaction_id);