SidebarComponent represents the todo display component for the sidebar
| 20 | |
| 21 | // SidebarComponent represents the todo display component for the sidebar |
| 22 | type SidebarComponent struct { |
| 23 | todos []todo.Todo |
| 24 | width int |
| 25 | |
| 26 | // renderCache memoizes the rendered todo list keyed by content width. |
| 27 | // Render() is called on every animation frame while the agent works (the |
| 28 | // sidebar rebuilds its whole cache on each spinner tick) and the two-pass |
| 29 | // scrollbar layout renders at two widths, so without this the O(todos) |
| 30 | // word-wrap+style work runs many times per second on long lists. Cleared |
| 31 | // when the todos change (SetTodos) or the theme changes (InvalidateCache). |
| 32 | renderCache map[int]string |
| 33 | } |
| 34 | |
| 35 | func NewSidebarComponent() *SidebarComponent { |
| 36 | return &SidebarComponent{ |
nothing calls this directly
no outgoing calls
no test coverage detected