xonecas.io
62159
Sy

symb / files

symb / internal / tui / update_resize.go

508 bytes
1package tui
2
3import (
4	tea "charm.land/bubbletea/v2"
5)
6
7// handleResize applies a window size change and re-derives layout.
8func (m *Model) handleResize(msg tea.WindowSizeMsg) {
9	m.width, m.height = msg.Width, msg.Height
10	m.layout = generateLayout(m.width, m.height)
11	m.updateComponentSizes()
12}
13
14// updateComponentSizes pushes layout dimensions to sub-models.
15func (m *Model) updateComponentSizes() {
16	m.agentInput.SetWidth(m.layout.input.Dx() - 2) // padding for border
17	m.agentInput.SetHeight(inputRows)
18}