MCPcopy Create free account
hub / github.com/codehamr/codehamr / preGrowTextarea

Method preGrowTextarea

internal/tui/render.go:153–158  ·  view source on GitHub ↗

preGrowTextarea inflates Height to the cap *before* a KeyMsg is processed. bubbles/textarea's repositionView() scrolls the viewport down when the cursor drops below Height (e.g. a typed char wraps); since recomputeLayout runs only AFTER handleKey, without this the viewport stays anchored at the scro

()

Source from the content-addressed store, hash-verified

151}
152
153// preGrowTextarea inflates Height to the cap *before* a KeyMsg is processed.
154// bubbles/textarea's repositionView() scrolls the viewport down when the
155// cursor drops below Height (e.g. a typed char wraps); since recomputeLayout
156// runs only AFTER handleKey, without this the viewport stays anchored at the
157// scrolled YOffset and hides the earliest wrap rows. Pre-growing keeps the
158// cursor in view so no scroll fires; recomputeLayout then shrinks back,
159// leaving YOffset at 0 and every wrapped row visible from the top.
160func (m *Model) preGrowTextarea() {
161 cap := m.maxTextareaHeight()

Callers 1

updateMethod · 0.95

Calls 3

maxTextareaHeightMethod · 0.95
HeightMethod · 0.80
SetHeightMethod · 0.80

Tested by

no test coverage detected