fixed replace bug

This commit is contained in:
Penwing 2024-01-24 19:47:01 +01:00
parent a6e71b377e
commit 338c5302e3
2 changed files with 7 additions and 2 deletions

View file

@ -1 +1 @@
{"tabs":["/home/penwing/Documents/notes/victory2.txt","untitled"],"theme":6} {"tabs":["/home/penwing/Documents/notes/victory2.txt"],"theme":6}

View file

@ -212,9 +212,14 @@ impl SearchWindow {
self.search(tabs, &mut *selected_tab); self.search(tabs, &mut *selected_tab);
} }
let mut done : Vec<TabNumber> = vec![];
for element in &self.results { for element in &self.results {
if done.contains(&element.tab) {
continue;
}
tabs[element.tab.to_index()].code = tabs[element.tab.to_index()].code.replace(&self.search_text, &self.replace_text); tabs[element.tab.to_index()].code = tabs[element.tab.to_index()].code.replace(&self.search_text, &self.replace_text);
tabs[element.tab.to_index()].saved = false; tabs[element.tab.to_index()].saved = false;
done.push(element.tab.clone())
} }
} }
} }