Skip to content

Commit 8a0ec4e

Browse files
Darth-Hidiousclaude
andcommitted
fix: tab navigation, Enter guard, tool count, tab switching from sidebar/chat
- Left/Right arrows switch workspace tabs when sidebar/chat focused - Number keys 1-9 switch tabs when not typing in input - Enter only fires in Input focus (no accidental empty messages) - Separate tool_count from model_count (was showing 535 instead of 106) - XML tool call parsing for Nvidia/Llama models - Brighter colors throughout Known issues to fix next session: - Sidebar items not selectable/highlightable (need StatefulList) - No interactive settings controls (temperature slider etc) - Text truncation in sidebar - Need proper tree widget for nested navigation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent da6ffe7 commit 8a0ec4e

4 files changed

Lines changed: 20 additions & 8 deletions

File tree

crates/cli/src/tui/components/sidebar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ fn draw_settings(f: &mut Frame, app: &App, area: Rect, focused: bool) {
304304
action("/billing", "Credit balance"),
305305
spacer(),
306306
section("Tools"),
307-
item(&format!("{} loaded", app.model_count.unwrap_or(106))),
307+
item(&format!("{} loaded", app.tool_count)),
308308
item("Custom: ~/.prism/tools/"),
309309
action("/tools", "Browse tools"),
310310
spacer(),

crates/cli/src/tui/components/status_bar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn draw(f: &mut Frame, app: &App, area: Rect) {
5050
sep.clone(),
5151
// Tools
5252
Span::styled(
53-
format!("{} tools", app.model_count.unwrap_or(106)),
53+
format!("{} tools", app.tool_count),
5454
Style::default().fg(Color::Rgb(130, 130, 130)),
5555
),
5656
sep.clone(),

crates/cli/src/tui/mod.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,9 +509,7 @@ pub async fn run_tui_app(
509509
}
510510
}
511511
protocol::ProtocolNotification::Welcome(w) => {
512-
if app.model_count.is_none() {
513-
app.model_count = Some(w.tool_count);
514-
}
512+
app.tool_count = w.tool_count;
515513
}
516514
protocol::ProtocolNotification::View(view) => {
517515
app.active_view = Some(view);
@@ -531,12 +529,24 @@ pub async fn run_tui_app(
531529
KeyCode::Char('e') if key.modifiers.contains(KeyModifiers::CONTROL) => {
532530
app.sidebar_visible = !app.sidebar_visible;
533531
}
534-
// Tab switching: Ctrl+1-9 for workspaces
532+
// Tab switching: 1-9 when NOT typing in input
533+
KeyCode::Char(c @ '1'..='9') if app.focus != state::FocusZone::Input => {
534+
let idx = (c as usize) - ('1' as usize);
535+
app.select_activity(idx);
536+
}
537+
// Ctrl+1-9 always works for tab switching
535538
KeyCode::Char(c @ '1'..='9') if key.modifiers.contains(KeyModifiers::CONTROL) => {
536539
let idx = (c as usize) - ('1' as usize);
537540
app.select_activity(idx);
538541
}
539-
// Alt+Left/Right to cycle workspace tabs
542+
// Left/Right arrows switch tabs when sidebar or chat is focused
543+
KeyCode::Left if app.focus == state::FocusZone::Sidebar || app.focus == state::FocusZone::Chat => {
544+
app.activity_up();
545+
}
546+
KeyCode::Right if app.focus == state::FocusZone::Sidebar || app.focus == state::FocusZone::Chat => {
547+
app.activity_down();
548+
}
549+
// Alt+Left/Right always works
540550
KeyCode::Left if key.modifiers.contains(KeyModifiers::ALT) => {
541551
app.activity_up();
542552
}
@@ -741,7 +751,7 @@ pub async fn run_tui_app(
741751
}
742752
}
743753
}
744-
KeyCode::Enter => {
754+
KeyCode::Enter if app.focus == state::FocusZone::Input || app.palette_visible || app.model_picker_visible => {
745755
// If palette is visible, execute the selected command
746756
if app.palette_visible {
747757
let commands = components::command_palette::all_commands();

crates/cli/src/tui/state.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ pub struct App {
175175
pub should_quit: bool,
176176

177177
// Cached workspace data
178+
pub tool_count: usize,
178179
pub model_count: Option<usize>,
179180
pub gpu_count: Option<usize>,
180181
pub node_count: Option<usize>,
@@ -217,6 +218,7 @@ impl App {
217218
cached_providers: Vec::new(),
218219
project_root,
219220
should_quit: false,
221+
tool_count: 0,
220222
model_count: None,
221223
gpu_count: None,
222224
node_count: None,

0 commit comments

Comments
 (0)