MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / layout

Method layout

internal/ui/program.go:520–541  ·  view source on GitHub ↗

layout recomputes viewport widths/heights from the current window size. In any modal state (debug detail OR approval-with-diff) the debug viewport is resized to fit the modal body; in every other state it goes back to the bottom-panel dimensions.

()

Source from the content-addressed store, hash-verified

518// viewport is resized to fit the modal body; in every other state it
519// goes back to the bottom-panel dimensions.
520func (m *harness) layout() {
521 m.input.Width = max(m.width-6, 20)
522
523 if m.inModal() {
524 modalW, modalH := m.modalSize()
525 // Inside: outer border (2 cols/rows) + horizontal padding (2 cols)
526 // + 2 rows for title + separator.
527 m.debugView.Width = max(modalW-4, 20)
528 m.debugView.Height = max(modalH-4, 4)
529 return
530 }
531
532 inputHeight := 5 // spinner line + box (3) + hint (1) — always reserved
533 debugH := 0
534 if debug.Enabled() {
535 debugH = debugPanelHeight
536 }
537 m.viewport.Width = m.width
538 m.viewport.Height = max(m.height-inputHeight-debugH, 3)
539 m.debugView.Width = max(m.width-2, 20)
540 m.debugView.Height = max(debugPanelHeight-2, 1)
541}
542
543// inModal reports whether the current state should render a centered
544// full-screen modal in place of the normal viewport+input layout. Two

Callers 4

UpdateMethod · 0.95
updateApprovalMethod · 0.95
toggleDebugFocusMethod · 0.95
updateDebugFocusMethod · 0.95

Calls 3

inModalMethod · 0.95
modalSizeMethod · 0.95
EnabledFunction · 0.92

Tested by

no test coverage detected