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

Function TestTypingPreservesEarlyContent

internal/tui/prompt_typing_test.go:33–43  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

31// preGrowTextarea inflates first so the cursor stays in view and
32// repositionView never scrolls.
33func 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

Callers

nothing calls this directly

Calls 5

newTestModelFunction · 0.85
typeCharsFunction · 0.85
HeightMethod · 0.80
visualPromptLinesMethod · 0.80
ViewMethod · 0.45

Tested by

no test coverage detected