draw_frame only cleared below the frame (\033[0J), so when a new screen's
lines were shorter than the previous screen's, the old tails (tool paths,
warnings) bled through on the right. Now erase-to-eol (\033[K) on every
line before the screen-clear.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
read_key used a fractional -t 0.01 timeout, which bash 3.2 (/bin/bash on
macOS) doesn't support — so arrow-key escape bytes ([A/[B) leaked through
and were parsed as letter commands (toggling instead of moving). Rewrite
to read the sequence byte-by-byte with integer timeouts and handle both
CSI ([) and SS3 (O) cursor modes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>