From 55fae767ae738c6fd235541ea4b8d73c7e97ae76 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 9 Jan 2024 13:40:55 -0700 Subject: [PATCH] Simple replace all implementation --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index a8d8bf7..4839b02 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1257,7 +1257,15 @@ impl Application for App { return self.update_focus(); } Message::FindReplaceAll => { - log::warn!("FIND REPLACE ALL"); + if !self.find_search_value.is_empty() { + if let Some(Tab::Editor(tab)) = self.active_tab() { + { + let mut editor = tab.editor.lock().unwrap(); + editor.set_cursor(cosmic_text::Cursor::new(0, 0)); + } + while tab.replace(&self.find_search_value, &self.find_replace_value) {} + } + } // Focus correct input return self.update_focus();