Problem
SessionList in internal/tui/components/sessionlist.go has 54 methods and PreviewPanel in internal/tui/components/preview.go has 34 methods. Both exceed a reasonable threshold for single-responsibility structs and qualify as god objects.
SessionList (54 methods) mixes concerns
| Concern |
Example Methods |
| Cursor/scroll |
MoveUp, MoveDown, MoveTo, ScrollOffset, ScrollBy |
| Selection |
Selected, SelectAll, DeselectAll, SelectByID, SelectRange, ToggleSelected |
| State management |
SetSessions, SetGroups, SetPivotField, SetSize |
| Tree mode |
CollapseAll, ExpandAll, ToggleFolder, CollapseFolder, ExpandFolder |
| Filters |
SetHiddenSessions, SetFavoritedSessions, SetAISessions, SetAttentionStatuses, SetWorkStatuses, SetPlanStatuses |
| Rendering |
View, renderSessionRow, renderFolderRow, attentionDot, planDot, workStatusDot |
PreviewPanel (34 methods) mixes concerns
| Concern |
Example Methods |
| Detail display |
SetDetail, Content, HasPlanContent, PlanViewMode |
| Scrolling |
ScrollUp, ScrollDown, PageUp, PageDown, ScrollOffset |
| Plan mode |
SetPlanContent, ShowPlanView, ExitPlanView, TogglePlanView |
| Text selection |
StartSelection, UpdateSelection, FinalizeSelection, SelectedText, HasSelection |
| Rendering |
View, renderContent, renderPlanContent, updateTotalLines |
| Status |
SetAttentionStatus, SetWorkStatus, SetConversationSort |
Suggested approach
Extract cohesive method groups into focused helper types:
- SessionList: extract a SessionListRenderer (rendering methods) and SelectionManager (selection logic), keep SessionList as the coordinator.
- PreviewPanel: extract a PreviewRenderer (View, renderContent, renderPlanContent) and TextSelectionHandler (StartSelection, UpdateSelection, FinalizeSelection, SelectedText).
This makes each type easier to test and reason about in isolation.
Problem
SessionList in internal/tui/components/sessionlist.go has 54 methods and PreviewPanel in internal/tui/components/preview.go has 34 methods. Both exceed a reasonable threshold for single-responsibility structs and qualify as god objects.
SessionList (54 methods) mixes concerns
PreviewPanel (34 methods) mixes concerns
Suggested approach
Extract cohesive method groups into focused helper types:
This makes each type easier to test and reason about in isolation.