From 14f3ca55d2e3cf3040f6087b7f4c31959926b912 Mon Sep 17 00:00:00 2001 From: darcy Date: Wed, 8 Jan 2025 13:28:13 +1100 Subject: [PATCH] fix: create new snap on replace --- yazi-core/src/input/commands/replace.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/yazi-core/src/input/commands/replace.rs b/yazi-core/src/input/commands/replace.rs index 20b77c08..20bc708a 100644 --- a/yazi-core/src/input/commands/replace.rs +++ b/yazi-core/src/input/commands/replace.rs @@ -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!(); } }