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
()
| 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. |
| 160 | func (m *Model) preGrowTextarea() { |
| 161 | cap := m.maxTextareaHeight() |
no test coverage detected