From 8ed71f40dcb5841d5fd261dc58652ee8322fe41c Mon Sep 17 00:00:00 2001 From: MihneaTeodorStoica Date: Sat, 8 Nov 2025 17:48:44 +0200 Subject: [PATCH] Focus command palette filter input on open --- src/bin/edit/draw_command_palette.rs | 4 ++++ src/bin/edit/main.rs | 1 + src/bin/edit/state.rs | 2 ++ 3 files changed, 7 insertions(+) diff --git a/src/bin/edit/draw_command_palette.rs b/src/bin/edit/draw_command_palette.rs index a5b1513..fbd407e 100644 --- a/src/bin/edit/draw_command_palette.rs +++ b/src/bin/edit/draw_command_palette.rs @@ -208,6 +208,10 @@ pub fn draw_command_palette(ctx: &mut Context, state: &mut State) { if ctx.editline("command-filter", &mut state.command_palette_filter) { state.command_palette_selection = 0; } + if state.command_palette_focus_filter { + state.command_palette_focus_filter = false; + ctx.steal_focus(); + } ctx.block_end(); let entries = build_command_entries(state); diff --git a/src/bin/edit/main.rs b/src/bin/edit/main.rs index 99791fd..45e5b02 100644 --- a/src/bin/edit/main.rs +++ b/src/bin/edit/main.rs @@ -361,6 +361,7 @@ fn draw(ctx: &mut Context, state: &mut State) { state.command_palette_filter.clear(); state.command_palette_selection = 0; state.command_palette_reset_selection = true; + state.command_palette_focus_filter = true; ctx.needs_rerender(); return; } else if key == kbmod::CTRL | vk::N { diff --git a/src/bin/edit/state.rs b/src/bin/edit/state.rs index 767dd33..dc36a1f 100644 --- a/src/bin/edit/state.rs +++ b/src/bin/edit/state.rs @@ -186,6 +186,7 @@ pub struct State { pub command_palette_filter: String, pub command_palette_selection: usize, pub command_palette_reset_selection: bool, + pub command_palette_focus_filter: bool, system_palette: [StraightRgba; INDEXED_COLORS_COUNT], } @@ -245,6 +246,7 @@ impl State { command_palette_filter: String::new(), command_palette_selection: 0, command_palette_reset_selection: false, + command_palette_focus_filter: false, system_palette: framebuffer::DEFAULT_THEME, }) }