mirror of
https://github.com/donlucasx/xscapes.git
synced 2026-10-20 08:43:32 +02:00
His OK, "Yes, in its own window". The probe ran in a window the script opened
and closed, resolved by the tty of the `do script` tab; his three windows were
never named.
Painted 120 wide, narrowed to 74, deleted rows 10-20 inside a scroll region and
repainted them at 74, widened back to 120, read the cells back:
rows 10-20 74 cells the retained tail is GONE
rows 1-4, 8-9, 21-24 120 cells controls, tails intact
row 7, narrow repaint 120 cells R07 + 70 g + < + 45 G + <
Row 7 reproduces item 3 exactly -- a repaint at the narrow width leaves the old
tail behind the new cells -- and the controls coming back at 120 are what makes
the DL rows' 74 mean something. So erase cannot reach those cells and a repaint
cannot, but replacing the row can: DL allocates a genuinely new row at the
visible width. It is the one mechanism that works and it touches only rows we
own, which is the objection that ruled out ESC[2J.
Item 4 of the audit was WRONG and is struck. The window IS snapped to the cell
grid: Terminal.app holds a fixed 20 px inset on each side and the text grid is
an exact multiple of the 14.000 px cell. Content width minus columns x 14 is
exactly 40 px on all five frames now measured -- 143x62, 120x30, 116x37, 76x41.
The "123.6 columns" reading divided the whole content view by the column count
and absorbed both insets; it is the same arithmetic that produced the bogus
14.28 px pitch this session started with. What survives is the half that
mattered: the inset is drawable, Terminal.app paints retained cells into it, and
they sit at columns W+1 and W+2 -- outside the grid, so no column-addressed
sequence can name them.
Also recorded: his line-spacing test failed ("no, it didnt"), so the hairline
cannot be removed inside half blocks, only not drawn; and the three frames he
sent at 120x30, 116x37 and 76x41 give the defect its own control -- the frame he
did not narrow into is clean at 5.4% of the inset, the two he did are 48.6% and
50.4%.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UJvgity4qhHtTGojUkFivG
68 lines
2.9 KiB
Bash
Executable File
68 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# drive-dl.sh -- runs widthprobe's DL arm in a Terminal window this script opens,
|
|
# and prints the read-back. His OK, 2026-09-07: "Yes, in its own window".
|
|
#
|
|
# The window is resolved by the TTY of the tab `do script` returns, never by
|
|
# `front window`: on 2026-09-03 a `front window` driver typed into HIS Claude
|
|
# session. Nothing here sends keystrokes, and every command names the window by
|
|
# the id resolved from that tty.
|
|
#
|
|
# The question: a stale strip at columns 144-145 of a 143-column terminal is the
|
|
# window's own inset holding RETAINED cells. Erase does not reach them
|
|
# (width-audit item 2), nor does a repaint at the narrow width (item 3). DL is
|
|
# the last mechanism that could -- it replaces rows rather than erasing cells.
|
|
#
|
|
# GREEN: rows 10-20 come back with NO tail past the narrow width, while the
|
|
# control rows still have theirs.
|
|
# RED: rows 10-20 keep their tails too. Then it is not fixable from inside
|
|
# the app, and the 123x55 verdict stands for this too.
|
|
set -uo pipefail
|
|
|
|
OUT="${1:?usage: drive-dl.sh <output-dir>}"
|
|
mkdir -p "$OUT"
|
|
BIN="$OUT/widthprobe-dl"
|
|
go build -o "$BIN" ./notes/widthprobe || exit 1
|
|
|
|
WIDE=120
|
|
NARROW=74
|
|
|
|
# 1. Open a window running the probe, and resolve it by tty.
|
|
read -r TTY WINID <<<"$(osascript <<'APPLESCRIPT'
|
|
tell application "Terminal"
|
|
set newTab to do script ""
|
|
set theTty to tty of newTab
|
|
set theId to 0
|
|
repeat with w in windows
|
|
repeat with tb in tabs of w
|
|
if tty of tb is theTty then set theId to id of w
|
|
end repeat
|
|
end repeat
|
|
return theTty & " " & theId
|
|
end tell
|
|
APPLESCRIPT
|
|
)"
|
|
|
|
if [ -z "${WINID:-}" ] || [ "$WINID" = "0" ]; then
|
|
echo "FATAL: could not resolve the window from its tty; refusing to touch any window" >&2
|
|
exit 1
|
|
fi
|
|
echo "probe window: tty=$TTY id=$WINID"
|
|
|
|
# Assert the resolved window is the one we opened and nothing else, by writing
|
|
# ONLY to that tty. No keystrokes, no `front window`, no System Events.
|
|
run_in_probe() { osascript -e "tell application \"Terminal\" to do script \"$1\" in (first tab of (first window whose id is $WINID))" >/dev/null; }
|
|
set_size() { osascript -e "tell application \"Terminal\" to set number of columns of (first window whose id is $WINID) to $1" \
|
|
-e "tell application \"Terminal\" to set number of rows of (first window whose id is $WINID) to $2" >/dev/null; }
|
|
read_back() { osascript -e "tell application \"Terminal\" to get history of (first tab of (first window whose id is $WINID))"; }
|
|
|
|
set_size "$WIDE" 40
|
|
run_in_probe "exec '$BIN'"
|
|
|
|
# The probe paints at t=3 (at the WIDE size), fires its arms at t=8.
|
|
sleep 5; set_size "$NARROW" 40; echo "narrowed to $NARROW"
|
|
sleep 6; set_size "$WIDE" 40; echo "widened back to $WIDE"
|
|
sleep 2; read_back > "$OUT/readback.txt"; echo "read back $(wc -l < "$OUT/readback.txt") lines"
|
|
|
|
osascript -e "tell application \"Terminal\" to close (first window whose id is $WINID)" >/dev/null 2>&1
|
|
echo "closed the probe window"
|