QOL shortcuts

This commit is contained in:
2025-12-09 18:39:01 +01:00
parent cc4fad4532
commit 7c2632a297
2 changed files with 21 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ pub fn render_search_panel(
state: &mut SearchPanelState,
search_state: &SearchState,
match_count: usize,
request_focus: bool,
) -> SearchPanelActions {
let mut actions = SearchPanelActions {
execute_search: false,
@@ -45,14 +46,21 @@ pub fn render_search_panel(
ui.add_space(4.0);
// Text input with proper height matching buttons
// Text input with proper height matching buttons and stable ID
let text_edit_width = 300.0;
let search_input_id = egui::Id::new("search_input_field");
let text_response = ui.add(
egui::TextEdit::singleline(&mut state.query)
.id(search_input_id)
.desired_width(text_edit_width)
.hint_text("Enter search query...")
);
// Request focus if Ctrl+F was pressed
if request_focus {
text_response.request_focus();
}
let enter_pressed =
text_response.lost_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter));