MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestResizeKeepsPromptInsideTerminal

Function TestResizeKeepsPromptInsideTerminal

internal/tui/resize_test.go:17–40  ·  view source on GitHub ↗

TestResizeKeepsPromptInsideTerminal: across a resize sequence View must never claim more rows than the terminal, else the textarea pushes the status bar off-screen or wraps mid-prompt.

(t *testing.T)

Source from the content-addressed store, hash-verified

15// never claim more rows than the terminal, else the textarea pushes the
16// status bar off-screen or wraps mid-prompt.
17func TestResizeKeepsPromptInsideTerminal(t *testing.T) {
18 cfg, _, _ := config.Bootstrap(t.TempDir())
19 m := New(cfg, llm.New("http://x", cfg.ActiveProfile().LLM, ""), t.TempDir(), "test")
20 var mm tea.Model = m
21
22 mx := m
23 mx.ta.ta.SetValue(strings.Repeat("abc def ghi jkl mno pqr stu vwx yz ", 20))
24 mm = mx
25
26 sizes := [][2]int{
27 {120, 40}, {60, 20}, {40, 15}, {20, 10},
28 {21, 10}, {20, 10}, {21, 10}, {20, 10},
29 {20, 8}, {30, 6}, {120, 40},
30 }
31 for _, s := range sizes {
32 w, h := s[0], s[1]
33 mm2, _ := mm.Update(tea.WindowSizeMsg{Width: w, Height: h})
34 mm = mm2
35 got := strings.Count(mm.View(), "\n") + 1
36 if got > h {
37 t.Errorf("size %dx%d: View has %d rows, must not exceed %d", w, h, got, h)
38 }
39 }
40}
41
42// TestFirstResizeDoesNotClearScreen: the first WindowSizeMsg must not
43// ClearScreen; the terminal still holds the user's pre-launch shell

Callers

nothing calls this directly

Calls 7

UpdateMethod · 0.95
ViewMethod · 0.95
BootstrapFunction · 0.92
NewFunction · 0.92
ActiveProfileMethod · 0.80
SetValueMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected