mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 00:02:23 +00:00
fix(palette): keep Tab inside the command palette
The palette is walked with the arrows and run with Enter; Tab has no job there. Root's focus walker had one for it anyway, and sent it out of the modal onto whichever chrome tile sat behind the scrim — the New Tab plus, the panel toggle — which lit up with a focus ring the palette had no way to take back. Tab and Shift-Tab bind to `NoAction` in the palette's own context, which is deeper than Root's and stops the search before the walker is reached.
This commit is contained in:
@@ -33,6 +33,11 @@ pub fn init(cx: &mut App) {
|
||||
SwitcherAcrossBack,
|
||||
Some("Switcher"),
|
||||
));
|
||||
// The palette has nowhere for Tab to go — the arrows walk the list and
|
||||
// Enter runs it — but Root's focus walker still had somewhere to send it:
|
||||
// out of the modal, onto whichever chrome tile is behind it, ring and all.
|
||||
bindings.push(KeyBinding::new("tab", NoAction {}, Some("Palette")));
|
||||
bindings.push(KeyBinding::new("shift-tab", NoAction {}, Some("Palette")));
|
||||
cx.bind_keys(bindings);
|
||||
cx.set_global(BoundKeystrokes(bound_keystrokes(&effective)));
|
||||
|
||||
|
||||
@@ -1137,6 +1137,7 @@ impl Render for PaletteView {
|
||||
.justify_center()
|
||||
.pt(px(120.))
|
||||
.bg(scrim)
|
||||
.key_context("Palette")
|
||||
.on_key_down(cx.listener(|this, ev: &gpui::KeyDownEvent, _window, cx| {
|
||||
let ks = &ev.keystroke;
|
||||
if is_edit_gesture(ks) {
|
||||
|
||||
Reference in New Issue
Block a user