TestTypingPreservesEarlyContent: a marker at the START of a line that wraps to many rows must stay visible in the textarea View. Guards a scroll bug: textarea's repositionView scrolls down when the cursor crosses below its Height; recomputeLayout grew Height *after* that scroll, leaving the marker'
(t *testing.T)
| 31 | // preGrowTextarea inflates first so the cursor stays in view and |
| 32 | // repositionView never scrolls. |
| 33 | func TestTypingPreservesEarlyContent(t *testing.T) { |
| 34 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 35 | final := typeChars(tea.Model(m), "ZZZSTART"+strings.Repeat("a", 300)) |
| 36 | mm := final.(Model) |
| 37 | view := mm.ta.View() |
| 38 | if !strings.Contains(view, "ZZZSTART") { |
| 39 | t.Fatalf("first chars typed are not visible - viewport scrolled past them.\n"+ |
| 40 | "ta height=%d visualLines=%d width=%d\nView:\n%s", |
| 41 | mm.ta.Height(), mm.visualPromptLines(), mm.width, view) |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // TestTypingOverflowKeepsCursorVisible: once content overflows |
| 46 | // maxTextareaHeight, pre-grow must NOT pin the viewport to the top: that |
nothing calls this directly
no test coverage detected