TestPromptAutoGrowsWithContent: the textarea starts at 1 line, grows with newlines, and clamps to height - minViewport - 2 - popover, so big pastes use most of the screen while chat keeps its floor.
(t *testing.T)
| 2386 | width int |
| 2387 | wantRows int |
| 2388 | }{ |
| 2389 | {"empty", "", 15, 1}, |
| 2390 | {"short fits", "hello", 15, 1}, |
| 2391 | {"short with spaces fits", "hi you", 15, 1}, |
| 2392 | {"exactly fills width adds cursor anchor", strings.Repeat("x", 15), 15, 2}, |
| 2393 | {"just under width", strings.Repeat("x", 14), 15, 1}, |
| 2394 | {"just over width hard-wraps", strings.Repeat("x", 16), 15, 2}, |
| 2395 | {"long hard-wrap no spaces", strings.Repeat("x", 45), 15, 4}, |
| 2396 | {"word-boundary wastes space", strings.Repeat("hello ", 20), 15, 10}, |
| 2397 | {"zero width floors to 1", "anything", 0, 1}, |
| 2398 | } |
| 2399 | for _, c := range cases { |
| 2400 | if got := wrapRows(c.input, c.width); got != c.wantRows { |
| 2401 | t.Errorf("wrapRows(%q, %d) = %d, want %d", c.input, c.width, got, c.wantRows) |
| 2402 | } |
| 2403 | } |
| 2404 | } |
| 2405 | |
| 2406 | // TestVisualPromptLinesSumsAcrossLogicalLines: visualPromptLines splits on |
| 2407 | // newlines and sums wrapRows for each segment: the prompt field grows to |
| 2408 | // hold the combined visual height. |
| 2409 | func TestVisualPromptLinesSumsAcrossLogicalLines(t *testing.T) { |
| 2410 | m := newTestModel(t, func(http.ResponseWriter, *http.Request) {}) |
| 2411 | // width=100, effective=96. Two short logical lines = 2 visual rows. |
| 2412 | m.ta.SetValue("first line\nsecond line") |
nothing calls this directly
no test coverage detected