wip
This commit is contained in:
@@ -111,3 +111,40 @@ func TestCursorShifterCUPNoClampWhenChildColsZero(t *testing.T) {
|
||||
t.Fatalf("childCols=0 should disable col clamping: got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
// In longer claude sessions the cursor's internal row state could drift
|
||||
// past the viewport height. CUP / HVP / VPA without row clamping would
|
||||
// then land the host cursor on the status row or above the tab bar,
|
||||
// where the next printable wipes the chrome.
|
||||
func TestCursorShifterClampsCUPRowToMainBottom(t *testing.T) {
|
||||
// rowOffset=2 (mainTop=3), childRows=36 → mainBottom=38.
|
||||
cs := newCursorShifter(2, 36, 80)
|
||||
got := cs.Shift([]byte("\x1b[40;5H"))
|
||||
if string(got) != "\x1b[38;5H" {
|
||||
t.Fatalf("CUP row 40 (post-shift 42) should clamp to 38: got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCursorShifterClampsHVPRowToMainBottom(t *testing.T) {
|
||||
cs := newCursorShifter(2, 36, 80)
|
||||
got := cs.Shift([]byte("\x1b[99;1f"))
|
||||
if string(got) != "\x1b[38;1f" {
|
||||
t.Fatalf("HVP row 99 should clamp to mainBottom: got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCursorShifterClampsVPARow(t *testing.T) {
|
||||
cs := newCursorShifter(2, 36, 80)
|
||||
got := cs.Shift([]byte("\x1b[60d"))
|
||||
if string(got) != "\x1b[38d" {
|
||||
t.Fatalf("VPA row 60 should clamp to mainBottom: got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCursorShifterCUPRowNoClampWhenChildRowsZero(t *testing.T) {
|
||||
cs := newCursorShifter(2, 0, 80)
|
||||
got := cs.Shift([]byte("\x1b[40;5H"))
|
||||
if string(got) != "\x1b[42;5H" {
|
||||
t.Fatalf("childRows=0 should disable row clamping: got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user