mirror of
https://github.com/microsoft/edit.git
synced 2025-12-23 07:07:25 +00:00
Focus command palette filter input on open
This commit is contained in:
parent
7b603cc6d8
commit
8ed71f40dc
3 changed files with 7 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue