fix(vt): erase the whole wide character when EL or ED starts on its second cell #1228
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.47) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.47 · 347 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.350
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #1228"
general
weight: 0.35
yxshee
When the cursor is on the second cell of a wide character,
CSI 0 KandCSI 0 Jin the vt emulator erased only that second cell. The first cell kept the wide character, so the character was left split. Ghostty's EL and ED pages say "if a multi-cell character would be split, erase the full multi-cell character" (https://ghostty.org/docs/vt/csi/el, https://ghostty.org/docs/vt/csi/ed). This is EL V-4 from that page:eraseToLineEndanderaseBelownow start one column to the left when the cell before the cursor holds a wide character. I put that check in a smalleraseStarthelper so both use it. The erase-left cases already come out right, because the second cell of a wide character is blank.Review here also showed that
putRuneleft the first cell marked wide when a narrow character overwrote the second cell, so a later erase reached one cell too far left.putRunenow clears that first cell and sends it to the backend, as DCH and ICH already do.Tests:
TestELv4andTestEDv3invt/tests/emulate_test.goare EL V-4 and ED V-3 from the Ghostty pages, in the same style as the other ported tests. On main they fail with:TestELv5,TestELv6andTestPutRuneOverwriteWideSecondCellcover theputRunepart; the last one fails on main because the first cell is never sent to the backend.go test ./...passes (underscript, as in CI),go test -race ./vt/...passes,gofmt -landgo vetare clean, and golangci-lint reports nothing new invt. This is separate from #1227 (pending wrap on EL/ED). They change different lines ofvt/emulate.go, but both add their tests afterTestDLv4, so whichever lands second needs a small merge invt/tests/emulate_test.go. Not run: Windows and wasm CI.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Erase-in-line and erase-in-display commands now correctly clear wide characters when the cursor is on the character’s second cell. Erase-in-line preserves content before the character, while erase-in-display clears the affected character and the remaining display, including subsequent rows.
* Overwriting the second cell of a wide character now clears its first cell. Subsequent erase operations clear both cells and apply the expected background colors, including when an erase is repeated.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->