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