added replace
This commit is contained in:
parent
82e3b64290
commit
53d9531646
|
@ -1 +1 @@
|
|||
{"tabs":["/home/penwing/Documents/notes/victory2.txt","untitled"],"theme":6}
|
||||
{"tabs":["/home/penwing/Documents/notes/victory2.txt"],"theme":6}
|
|
@ -147,7 +147,6 @@ impl super::Calcifer {
|
|||
CCursor::new(self.search.get_cursor_end()),
|
||||
));
|
||||
self.search.result_selected = true;
|
||||
println!("Override cursor set : [{}, {}]", self.search.get_cursor_start(), self.search.get_cursor_end());
|
||||
}
|
||||
|
||||
CodeEditor::default().id_source("code editor")
|
||||
|
|
|
@ -210,7 +210,6 @@ impl CodeEditor {
|
|||
output.response.request_focus();
|
||||
output.state.set_ccursor_range(override_cursor);
|
||||
output.state.store(ui.ctx(), output.response.id);
|
||||
println!("Cursor range overriden");
|
||||
}
|
||||
|
||||
//text_edit_output = Some(output);
|
||||
|
|
|
@ -182,8 +182,10 @@ impl SearchWindow {
|
|||
self.results = search_results.clone();
|
||||
|
||||
self.current_result = 0;
|
||||
self.result_selected = false;
|
||||
self.tab_selected = false;
|
||||
if self.results.len() > 0 {
|
||||
self.result_selected = false;
|
||||
self.tab_selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
fn match_text(&self, tab_text: String, tab_number: TabNumber) -> Vec<Selection> {
|
||||
|
@ -220,7 +222,15 @@ impl SearchWindow {
|
|||
}
|
||||
}
|
||||
|
||||
fn replace(&mut self, tabs: &Vec<Tab>, selected_tab: &TabNumber) {
|
||||
println!("Searched to replace {} with {}, tab lang : {} ", &self.search_text, &self.replace_text, tabs[selected_tab.to_index()].language);
|
||||
fn replace(&mut self, tabs: &mut Vec<Tab>, selected_tab: &TabNumber) {
|
||||
if self.searched_text != self.search_text {
|
||||
self.search(tabs, selected_tab);
|
||||
}
|
||||
|
||||
println!("trying to replace {} with {}", self.search_text, self.replace_text);
|
||||
|
||||
for element in &self.results {
|
||||
tabs[element.tab.to_index()].code = tabs[element.tab.to_index()].code.replace(&self.search_text, &self.replace_text);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue