File: src/screen.zig (CUF/CUB/CBT handlers)
Severity: HIGH
Status: ❌ FALSE POSITIVE (intentional design)
Related: deferred-wrap representation is otherwise sound (cursor.x == width)
On closer inspection this is deliberate, tested behaviour, not an accident:
screen.zig carries dedicated regression tests asserting exactly this
motion: “cursorBack steps back across soft-wrapped line boundaries” and
“cursorForward steps forward across soft-wrapped line boundaries”.While strict xterm/VT510 CUF/CUB clamps at margins, szn’s logical-line-aware horizontal movement supports modern TUIs navigating wrapped output. Changing it would break the documented design. Closing as intentional; revisit only if a concrete app incompatibility appears.
The audit sweep found CUF past the last column and CUB before column 0 can carry into adjacent rows instead of stopping at the margin, and back-tab skips tab stops across the left edge incorrectly. Applications that position the cursor with relative moves near edges (ncurses apps) render misaligned.
Clamp CUF at the right margin (respecting the deferred-wrap x == width
state) and CUB at column 0; make back-tab iterate stops within the row only.
Add boundary tests mirroring the existing wrap tests.