Compare commits

...
Author SHA1 Message Date
anandh8x 401d4dcc67 test(tui): cover medium sidebar footer hint 2026-07-30 17:13:50 +05:30
anandh8x 99daf8fa66 fix(tui): hide unavailable sidebar shortcut 2026-07-29 20:42:01 +05:30
2 changed files with 41 additions and 5 deletions

No files matched your search

+11 -2
View File
@@ -3036,9 +3036,18 @@ func (m model) composerIdleHint() string {
case tierNarrow:
hint = "? shortcuts"
case tierMedium:
hint = fmt.Sprintf("? shortcuts · Ctrl+X cmds · %s sidebar", sidebarKey)
parts := []string{"? shortcuts", "Ctrl+X cmds"}
if m.sidebarAvailable() {
parts = append(parts, sidebarKey+" sidebar")
}
hint = strings.Join(parts, " · ")
default:
hint = fmt.Sprintf("? shortcuts · Ctrl+X cmds · %s sidebar · %s detail · %s copy · Shift+Tab mode", sidebarKey, detailKey, mouseKey)
parts := []string{"? shortcuts", "Ctrl+X cmds"}
if m.sidebarAvailable() {
parts = append(parts, sidebarKey+" sidebar")
}
parts = append(parts, detailKey+" detail", mouseKey+" copy", "Shift+Tab mode")
hint = strings.Join(parts, " · ")
}
return zeroTheme.faint.Render(hint)
}
+30 -3
View File
@@ -2501,9 +2501,36 @@ func TestComposerIdleHintAndJumpCue(t *testing.T) {
m.width, m.height = 100, 30
m.transcript = append(m.transcript, transcriptRow{kind: rowAssistant, text: "hi", final: true})
// Idle, empty composer, managed mode -> the discoverability hint shows.
if h := plainRender(t, m.composerIdleHint()); !strings.Contains(h, "shortcuts") {
t.Fatalf("expected idle hint, got %q", h)
for _, test := range []struct {
name string
width int
}{
{name: "medium", width: 80},
{name: "full", width: 100},
} {
t.Run(test.name, func(t *testing.T) {
idle := m
idle.width = test.width
// Idle, empty composer, managed mode -> the discoverability hint shows.
hint := plainRender(t, idle.composerIdleHint())
if !strings.Contains(hint, "shortcuts") {
t.Fatalf("expected idle hint, got %q", hint)
}
if strings.Contains(hint, "sidebar") {
t.Fatalf("empty sidebar should not be advertised, got %q", hint)
}
withSidebar := idle
withSidebar.plan.steps = []planStep{{content: "inspect footer", status: "in_progress"}}
if hint := plainRender(t, withSidebar.composerIdleHint()); !strings.Contains(hint, "Ctrl+B sidebar") {
t.Fatalf("available sidebar should be advertised, got %q", hint)
}
withSidebar.sidebarHidden = true
if hint := plainRender(t, withSidebar.composerIdleHint()); !strings.Contains(hint, "Ctrl+B sidebar") {
t.Fatalf("collapsed sidebar should keep its restore shortcut, got %q", hint)
}
})
}
// Hidden during a run.
busy := m