fix: create new snap on replace

This commit is contained in:
darcy 2025-01-08 13:28:13 +11:00 committed by sxyazi
parent 44755143db
commit 14f3ca55d2
No known key found for this signature in database

View file

@ -14,8 +14,6 @@ impl Input {
}
}
// FIXME: need to create a new snap for each replace operation, otherwise we
// can't undo/redo it with `u` and `Ctrl-r`
pub fn replace_str(&mut self, s: &str) {
let snap = self.snap_mut();
@ -25,7 +23,7 @@ impl Input {
snap.mode = InputMode::Normal;
snap.value.replace_range(start..end, s);
self.flush_value();
self.snaps.tag(self.limit()).then(|| self.flush_value());
render!();
}
}