commit f242df85b1ae50a9afd504aef32764727e3c05c1
parent 3e54e3ae3c2405f424b9515ac343965b197baf73
Author: William Casarin <jb55@jb55.com>
Date: Mon, 26 Jan 2026 18:44:42 -0800
dave: allow Tab/Shift+Tab agent cycling even with text input focus
Move Tab keybinding handling before the wants_keyboard_input() check
so users can quickly switch between agents while typing in the chat
input field.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat:
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/crates/notedeck_dave/src/ui/keybindings.rs b/crates/notedeck_dave/src/ui/keybindings.rs
@@ -19,7 +19,7 @@ pub enum KeyAction {
Interrupt,
}
-/// Check for keybinding actions when no text input has focus
+/// Check for keybinding actions.
/// If `has_pending_permission` is true, keys 1/2 are used for permission responses
/// instead of agent switching.
pub fn check_keybindings(ctx: &egui::Context, has_pending_permission: bool) -> Option<KeyAction> {
@@ -28,6 +28,21 @@ pub fn check_keybindings(ctx: &egui::Context, has_pending_permission: bool) -> O
return Some(KeyAction::Interrupt);
}
+ // Tab / Shift+Tab for cycling through agents (works even with text input focus)
+ if let Some(action) = ctx.input(|i| {
+ if i.key_pressed(Key::Tab) {
+ if i.modifiers.shift {
+ Some(KeyAction::PreviousAgent)
+ } else {
+ Some(KeyAction::NextAgent)
+ }
+ } else {
+ None
+ }
+ }) {
+ return Some(action);
+ }
+
// Only process other keys when no text input has focus
if ctx.wants_keyboard_input() {
return None;
@@ -64,15 +79,6 @@ pub fn check_keybindings(ctx: &egui::Context, has_pending_permission: bool) -> O
}
}
- // Tab / Shift+Tab for cycling through agents
- if i.key_pressed(Key::Tab) {
- if i.modifiers.shift {
- return Some(KeyAction::PreviousAgent);
- } else {
- return Some(KeyAction::NextAgent);
- }
- }
-
// N to spawn a new agent
if i.key_pressed(Key::N) {
return Some(KeyAction::NewAgent);