From 61b888cf3fe829cf2b0e33361fb7104796e9c8d4 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 3 May 2026 23:35:36 -0700 Subject: [PATCH] fix(tui): label detail panes by layout --- tui/tui.go | 5 ++++- tui/tui_test.go | 26 +++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/tui/tui.go b/tui/tui.go index 6792142..5546088 100644 --- a/tui/tui.go +++ b/tui/tui.go @@ -1929,7 +1929,7 @@ func (m *model) syncDetailViewport() { } func (m *model) configureDetailViewport(rect rect, lines []string) { - title := detailModeLabel(m.compactDetail) + title := m.detailPaneTitle() + " " + detailModeLabel(m.compactDetail) if focus := paneFocusLabel(m.focus == focusDetail); focus != "" { title += " " + focus } @@ -3027,6 +3027,9 @@ func (m model) detailPaneTitle() string { if m.layoutPreset == LayoutChat { return "Thread" } + if m.layoutPreset == LayoutDocument { + return "Page" + } return "Detail" } diff --git a/tui/tui_test.go b/tui/tui_test.go index 95bd256..9a68f2f 100644 --- a/tui/tui_test.go +++ b/tui/tui_test.go @@ -1070,7 +1070,7 @@ func TestActionMenuUsesGitcrawlDetailChrome(t *testing.T) { t.Fatalf("action menu status = %q, want Row Actions", m.status) } view := stripANSI(m.View()) - for _, want := range []string{"Detail full", "Channels Actions", "Row Actions", "group scope", "Open selected URL"} { + for _, want := range []string{"Thread full", "Channels Actions", "Row Actions", "group scope", "Open selected URL"} { if !strings.Contains(view, want) { t.Fatalf("action menu chrome missing %q:\n%s", want, view) } @@ -1100,6 +1100,30 @@ func TestActionMenuTitlesFollowFocusedPane(t *testing.T) { } } +func TestDetailPaneTitleFollowsLayout(t *testing.T) { + chat := newModel(Options{ + Title: "chat archive", + Layout: LayoutChat, + Items: []Item{Row{Kind: "message", Container: "general", Title: "hello"}.ItemForLayout(LayoutChat)}, + }) + chat.width = 160 + chat.height = 24 + if view := stripANSI(chat.View()); !strings.Contains(view, "Thread full") { + t.Fatalf("chat detail pane should be labeled as a thread:\n%s", view) + } + + doc := newModel(Options{ + Title: "doc archive", + Layout: LayoutDocument, + Items: []Item{Row{Kind: "page", ParentID: "workspace", Title: "Roadmap"}.ItemForLayout(LayoutDocument)}, + }) + doc.width = 160 + doc.height = 24 + if view := stripANSI(doc.View()); !strings.Contains(view, "Page full") { + t.Fatalf("document detail pane should be labeled as a page:\n%s", view) + } +} + func TestMouseDoubleClickOpensSelectedRowURL(t *testing.T) { previousOpen := openURL var opened []string