notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 0f44c3f7574a751ab6dcda274c61816bdb7718b6
parent 8095f92267a63497e1abf08eaf4283882aac41f1
Author: William Casarin <jb55@jb55.com>
Date:   Tue, 27 Jan 2026 08:01:32 -0800

dave: fix keybind hints to match actual Ctrl+N shortcuts

The keybind hints were showing the SessionId (which starts at 1 and
increments), but the Ctrl+N keybindings use the index in the session
order. This caused Ctrl+1 to switch to the agent labeled "2", etc.

Fix by passing the 1-indexed keybind number to draw_agent and using
sessions_ordered() to iterate in the same order as the keybindings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Mcrates/notedeck_dave/src/ui/keybind_hint.rs | 5+++--
Mcrates/notedeck_dave/src/ui/scene.rs | 10+++++++---
Mcrates/notedeck_dave/src/ui/session_list.rs | 6+-----
3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/crates/notedeck_dave/src/ui/keybind_hint.rs b/crates/notedeck_dave/src/ui/keybind_hint.rs @@ -52,10 +52,11 @@ impl<'a> KeybindHint<'a> { egui::StrokeKind::Inside, ); - // Text in center + // Text in center (slight vertical nudge for better optical centering) let font_size = self.size * 0.65; + let text_pos = rect.center() + Vec2::new(0.0, 2.0); painter.text( - rect.center(), + text_pos, egui::Align2::CENTER_CENTER, self.text, egui::FontId::monospace(font_size), diff --git a/crates/notedeck_dave/src/ui/scene.rs b/crates/notedeck_dave/src/ui/scene.rs @@ -182,15 +182,17 @@ impl AgentScene { .zoom_range(0.1..=1.0) .show(ui, &mut scene_rect, |ui| { // Draw agents and collect interaction responses - for session in session_manager.iter() { + // Use sessions_ordered() to match keybinding order (Ctrl+1 = first in order, etc.) + for (keybind_idx, session) in session_manager.sessions_ordered().into_iter().enumerate() { let id = session.id; + let keybind_number = keybind_idx + 1; // 1-indexed for display let position = session.scene_position; let status = session.status(); let title = &session.title; let is_selected = selected_ids.contains(&id); let agent_response = - Self::draw_agent(ui, id, position, status, title, is_selected, ctrl_held); + Self::draw_agent(ui, id, keybind_number, position, status, title, is_selected, ctrl_held); if agent_response.clicked() { let shift = ui.input(|i| i.modifiers.shift); @@ -314,9 +316,11 @@ impl AgentScene { } /// Draw a single agent unit and return the interaction Response + /// `keybind_number` is the 1-indexed number displayed when Ctrl is held (matches Ctrl+N keybindings) fn draw_agent( ui: &mut egui::Ui, id: SessionId, + keybind_number: usize, position: Vec2, status: AgentStatus, title: &str, @@ -359,7 +363,7 @@ impl AgentScene { // Agent icon in center: show keybind frame when Ctrl held, otherwise first letter if show_keybinding { - paint_keybind_hint(ui, center, &id.to_string(), 24.0); + paint_keybind_hint(ui, center, &keybind_number.to_string(), 24.0); } else { let icon_text: String = title.chars().next().unwrap_or('?').to_uppercase().collect(); painter.text( diff --git a/crates/notedeck_dave/src/ui/session_list.rs b/crates/notedeck_dave/src/ui/session_list.rs @@ -76,11 +76,7 @@ impl<'a> SessionListUi<'a> { for (index, session) in self.session_manager.sessions_ordered().iter().enumerate() { let is_active = Some(session.id) == active_id; // Show keyboard shortcut hint for first 9 sessions (1-9 keys) - let shortcut_hint = if index < 9 { - Some(index + 1) - } else { - None - }; + let shortcut_hint = if index < 9 { Some(index + 1) } else { None }; let response = self.session_item_ui(ui, &session.title, is_active, shortcut_hint);