SetSize updates the viewport dimensions.
(w, h int)
| 118 | |
| 119 | // SetSize updates the viewport dimensions. |
| 120 | func (m *LessModel) SetSize(w, h int) { |
| 121 | m.width = w |
| 122 | m.height = h |
| 123 | // Reserve 1 line for title, 1 for status/input bar |
| 124 | vpHeight := h - 2 |
| 125 | if vpHeight < 1 { |
| 126 | vpHeight = 1 |
| 127 | } |
| 128 | m.viewport.SetWidth(w) |
| 129 | m.viewport.SetHeight(vpHeight) |
| 130 | // Re-apply content so viewport recalculates with new dimensions |
| 131 | if m.content != "" { |
| 132 | m.viewport.SetContent(strings.Join(m.filtered, "\n")) |
| 133 | m.applySearch() |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // Update handles key events for the less viewer. |
| 138 | func (m LessModel) Update(msg tea.Msg) (LessModel, tea.Cmd) { |