fix(tui): focus chat group columns

This commit is contained in:
Vincent Koc 2026-05-03 09:34:52 -07:00
parent 2f54e0cd70
commit befedc531e
No known key found for this signature in database
2 changed files with 7 additions and 4 deletions

View File

@ -3159,7 +3159,7 @@ func (m model) groupColumns(width int) []tableColumn {
{Key: "time", Title: activeTimeLabel("latest", active), Width: timeW},
{Key: "age", Title: activeTimeLabel("age", active), Width: ageW},
}
if m.hasVisibleGroupScope() {
if m.shouldShowGroupScopeColumn() {
scopeW := minInt(maxInt(8, width/7), 16)
titleW := maxInt(1, width-kindW-countW-timeW-ageW-scopeW-5)
columns = append(columns, tableColumn{Key: "scope", Title: activeLabel("scope", active == sortScope), Width: scopeW})
@ -3171,7 +3171,10 @@ func (m model) groupColumns(width int) []tableColumn {
return columns
}
func (m model) hasVisibleGroupScope() bool {
func (m model) shouldShowGroupScopeColumn() bool {
if m.layoutPreset == LayoutChat {
return false
}
for _, group := range m.groups {
if strings.TrimSpace(group.Scope) != "" {
return true

View File

@ -229,7 +229,7 @@ func TestViewUsesGitcrawlStylePaneTables(t *testing.T) {
m.width = 300
m.height = 28
view := stripANSI(m.View())
for _, want := range []string{"kind", "msgs", "latest", "scope", "channel", "time", "who", "title"} {
for _, want := range []string{"kind", "msgs", "latest", "channel", "time", "who", "title"} {
if !strings.Contains(view, want) {
t.Fatalf("table view missing %q:\n%s", want, view)
}
@ -262,7 +262,7 @@ func TestWideRenderFillsTerminalAndKeepsThreePaneColumns(t *testing.T) {
if len(lines[0]) != 220 || len(lines[len(lines)-1]) != 220 {
t.Fatalf("view did not fill terminal width: first=%d last=%d\n%s", len(lines[0]), len(lines[len(lines)-1]), view)
}
for _, want := range []string{"Channels", "Messages", "3/3 rows", "Conversation", "kind", "msgs", "latest", "age", "scope", "channel", "time", "who", "title"} {
for _, want := range []string{"Channels", "Messages", "3/3 rows", "Conversation", "kind", "msgs", "latest", "age", "channel", "time", "who", "title"} {
if !strings.Contains(view, want) {
t.Fatalf("wide render missing %q:\n%s", want, view)
}