SetSize sets the viewport dimensions. Rebuilds the line cache if width changed.
(width, height int)
| 97 | |
| 98 | // SetSize sets the viewport dimensions. Rebuilds the line cache if width changed. |
| 99 | func (l *LogViewer) SetSize(width, height int) { |
| 100 | widthChanged := l.width != width |
| 101 | l.width = width |
| 102 | l.height = height |
| 103 | |
| 104 | if widthChanged && width > 0 { |
| 105 | l.rebuildCache() |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // rebuildCache re-renders all entries using the current width. |
| 110 | // This is called when the terminal is resized. Syntax highlighting is NOT |