@@ -16,13 +16,13 @@ func (m *Model) resizeTable(filtered []session.Session) {
1616 }
1717 // Subtract pane border (2) for inner width; header join (1) for height.
1818 tableW := max (40 , width - 2 )
19- summaryW := max ( 16 , tableW - 63 )
19+ projectW , summaryW := sessionColumnWidths ( tableW )
2020 height := max (2 , uilayout .PaneBodyHeight (uilayout .BottomPaneHeight (m .height ))- 1 )
2121 m .sessionTable .SetColumns ([]table.Column {
2222 {Title : m .sortHeader ("Last Active" , session .SortUpdated ), Width : 14 },
2323 {Title : m .sortHeader ("Tool" , session .SortTool ), Width : 8 },
2424 {Title : m .sortHeader ("Status" , session .SortStatus ), Width : 11 },
25- {Title : m .sortHeader ("Project" , session .SortProject ), Width : 20 },
25+ {Title : m .sortHeader ("Project" , session .SortProject ), Width : projectW },
2626 {Title : m .sortHeader ("Summary" , session .SortSummary ), Width : summaryW },
2727 })
2828 m .sessionTable .SetWidth (tableW )
@@ -32,20 +32,31 @@ func (m *Model) resizeTable(filtered []session.Session) {
3232
3333func (m * Model ) syncTable (filtered []session.Session ) {
3434 rows := make ([]table.Row , 0 , len (filtered ))
35- summaryWidth := max ( 16 , m .sessionTable .Width ()- 63 )
35+ projectW , summaryW := sessionColumnWidths ( m .sessionTable .Width ())
3636 for _ , s := range filtered {
3737 status := uiutil .SessionStatusLabel (s )
3838 rows = append (rows , table.Row {
3939 uiutil .TimeAgo (uiutil .LastActive (s )),
4040 uiutil .Capitalize (s .Tool ),
4141 theme .StatusStyle (status ).Render (uiutil .TruncateForCell (status , 11 )),
42- uiutil .TruncateForCell ( uiutil . CleanProjectName ( s .Project ), 20 ),
43- uiutil .TruncateForCell (uiutil .CleanSummary (s .Summary ), summaryWidth ),
42+ uiutil .TruncateProject ( s .Project , projectW ),
43+ uiutil .TruncateForCell (uiutil .CleanSummary (s .Summary ), summaryW ),
4444 })
4545 }
4646 m .sessionTable .SetRows (rows )
4747}
4848
49+ func sessionColumnWidths (tableW int ) (int , int ) {
50+ const fixed = 14 + 8 + 11
51+ const cellPad = 5 * 2
52+ const minSummaryW = 16
53+ available := max (36 , tableW - fixed - cellPad )
54+ projectW := min (36 , max (24 , available / 3 ))
55+ projectW = min (projectW , available - minSummaryW )
56+ summaryW := max (minSummaryW , available - projectW )
57+ return projectW , summaryW
58+ }
59+
4960func (m * Model ) resizeSourceTable () {
5061 width := max (40 , m .width * 70 / 100 - 6 )
5162 m .sourceTable .SetColumns ([]table.Column {
0 commit comments