Skip to content

Commit f0f7ead

Browse files
committed
Re-perform search, when re-opening search bar
1 parent f676eb1 commit f0f7ead

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

gui/src/search_bar.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,22 @@ impl SearchBar {
174174

175175
/// Show the search bar and focus the input
176176
/// Selects all existing text so typing replaces it
177+
/// If there's existing text, triggers the search callback to highlight matches
177178
pub fn show(&mut self) {
178179
self.group.show();
179-
let len = self.input.value().len() as i32;
180+
let text = self.input.value();
181+
let len = text.len() as i32;
180182
self.input.take_focus().ok();
181183
if len > 0 {
182184
// In FLTK, position is cursor, mark is selection anchor
183185
// Setting position to end first, then mark to 0 selects all
184186
self.input.set_position(len).ok();
185187
self.input.set_mark(0).ok();
188+
189+
// Trigger the search callback with existing text to highlight matches
190+
if let Some(cb) = &mut *self.on_search.borrow_mut() {
191+
cb(text);
192+
}
186193
}
187194
}
188195

0 commit comments

Comments
 (0)