Skip to content

fix(terminal): preserve wide glyphs when inserting before them - #264

Merged
johnny4young merged 7 commits into
mainfrom
fix/terminal-wide-insertion-oct08
Oct 8, 2026
Merged

johnny4young merged 7 commits into
mainfrom
fix/terminal-wide-insertion-oct08

Conversation

@johnny4young

@johnny4young johnny4young commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Refresh qualified — 2026-10-08

Source head: 6e047f95100ef2c5187f7c02c7c66d812631caba.
Frozen main: a9796abd92b28e96c283d12c89769a16c57fbf59 (through #258).
Verified local/uploaded tree: ee1864e879275622f482ed14af4f665374183ba6.

This clean, forward-only merge preserves the previous PR head and all frozen-main changes. The terminal implementation and regression blobs are unchanged. The delta against this base remains four files, 103 additions and one deletion.

  • Local site image generation, check/build and all 63 tests pass with zero skips.
  • Diff checks, repository hygiene, changelog/version checks and portable lint prerequisites pass.
  • Native make format, make lint, make build and make test were attempted; this Linux executor lacks xcrun/Xcode/XcodeGen. The archive self-test explicitly skips without ditto/unzip.
  • Exact-head CI 37813704530 completed successfully: all five jobs passed. GitGuardian also passed. Earlier green evidence below remains historical; this run qualifies the refreshed source and tested merge described next.

The PR stays draft. No force push, gate changes, merge to main, release or deployment.

Exact tested integration

The source commit has parents 463532cb8a2375d0319640a065f99819bc2386f7 and the approved frozen main a9796abd92b28e96c283d12c89769a16c57fbf59. No force push was used, and the terminal implementation/regression blobs are unchanged.

All four native checkout logs identify GitHub's synthetic merge 3779fb6fbbcc8ecd111e935882a503812296b2fb, tree 5ea2646f3190d16ae29956fd84199db4f770ca51. Its parents are later main bae70943043a40096f3bff18aabd15a9cfc5a126 (including #259) and exact source head 6e047f95100ef2c5187f7c02c7c66d812631caba. This is the integration actually exercised by CI; the approved source freeze remains a9796ab.

  • All 17 new insertion-regression invocations passed on both Sequoia and Tahoe.
  • Strict Swift formatting, Debug/universal Release builds, unit tests, coverage, performance and existing golden gates passed on both rows.
  • CI reports critical diff coverage of 97/97 executable lines across four files on both rows. That aggregate includes the later main delta; it is not presented as this PR's isolated three-line change.
  • Each ordinary UI lane reported 108 cases, zero failures and the existing 26 intentional tour skips. Each separate strict tour executed all 26 cases successfully and exported/validated all 53 required screenshots.
  • Linux static/site checks and GitGuardian passed. No gate, baseline, threshold or expected skip was relaxed.
  • Final readback verified unchanged source head, matching local/remote source tree, draft status, no review comments or submitted reviews, and no merge conflict.

Main subsequently advanced to 9e1bb912508ba6ebb4f120c3c12aab88f18d9991 through #260 at 18:42 UTC. The PR is conflict-free but behind that later main. That later integration has not been qualified by this run; no further source refresh is made beyond the agreed freeze. Scoped refresh validation is complete for the source and tested merge pinned above. The PR remains draft for human review; no merge to main, release or deployment occurred.

Finding

Inserting cells at a wide CJK/emoji glyph's leading cell erased that complete glyph before shifting the row. For example, 你Z + CSI 1 G + CSI @ produced three spaces followed by Z instead of one space followed by 你Z.

Change

Only clear the existing wide cluster when insertion starts inside its continuation cell. A complete head/continuation pair shifts together, and the existing right-margin repair still clears truncated pairs. The ordinary insertion fill policy and pen state are unchanged.

Regression coverage

Seven domain tests provide 15 invocations and one rendering test provides two invocations per platform:

  • CJK and emoji, one/two inserted cells, at the start and middle of a row
  • Insertion inside a continuation, with existing clearing behavior preserved
  • A wide glyph fitting exactly at the right margin versus a truncated pair
  • Preserved glyph attributes, unchanged pen, and ordinary insertion's fill policy
  • Empty rows and cursor positions beyond the written tail
  • Alternate-screen reconstruction through ANSIRenderer

Earlier integrations (historical)

Source head: 463532cb8a2375d0319640a065f99819bc2386f7.
Then-integrated main: d97d4e7bb5625003ef286de125f00f99f1706f21.
Verified local staged/uploaded tree: 487f1dec6fce0d797fc8b9e0b7df0801b0834f88.

Main changed during qualification twice; both integrations use ordinary non-force merge commits:

  1. fix: full app review — editor, menu bar, settings, domain, web/CLI, docs and screenshots #251 merged as 3bda6abc. Resolve its adjacent production conflict by retaining this PR's continuation-only guard and fix: full app review — editor, menu bar, settings, domain, web/CLI, docs and screenshots #251's erasedCell insertion fill.
  2. fix(cli): protect batch artifacts and skipped inputs during preflight #254 merged as d97d4e7b. Its only overlap was the changelog's shared insertion point. Preserve all entries and place this PR's note beside the existing terminal fixes instead.

The terminal production and regression file blobs are unchanged from the fully green c0bc3b73 head below. The delta against that historical main remained four files, 103 additions and one deletion. The historical CI qualification below covers that prior combined tree.

All 13 then-open PRs were inventoried before publication; #251 was the only terminal-code overlap. The new style regression compares wide and ordinary insertion rather than freezing the pre-BCE fill.

Verification

  • git diff --check, repository hygiene and changelog/version checks pass after both integrations. Uploaded trees exactly match locally staged trees.
  • A portable behavioral model reproduces eight failing baseline cases; all 13 repaired/control examples pass. This is model evidence, not execution of Swift.
  • make format, make lint, make build and make test were attempted on the final integrated main. Portable lint prerequisites pass; local native formatting/build/tests remain unavailable without xcrun/Xcode/XcodeGen. The archive self-test explicitly skips without ditto/unzip.
  • The current head's ordinary hosted CI passed; see exact-head qualification below. No workflow expansion, gate/baseline relaxation, manual dispatch, force push, merge to main, release or deployment.

Fully green earlier integration

CI 37731465913 completed successfully for source c0bc3b73c199be228bf40d83595beca10e9f46f4, tree 6c9cff5734735eab795f68e8884338ebf5204f89, including merged #251. All five jobs passed:

  • All 17 new regression invocations passed on each supported macOS row.
  • Strict Swift formatting, Debug/universal Release builds, coverage, performance and golden gates passed.
  • Critical changed-line coverage was 3/3 (100%) on both rows. Production coverage: Sequoia 28,700/48,575 = 59.08%; Tahoe 28,762/48,575 = 59.21%, above the unchanged floors.
  • Each ordinary UI run reported 108 cases, zero failures, and the same 26 intentional tour skips. Each separate strict tour executed all 26 successfully and exported/validated all 53 required screenshots.
  • Linux static/site checks passed.

This earlier qualification remains a historical record; the latest combined tree is qualified separately below.

Prior exact-head qualification

CI 37739886583 completed successfully on unchanged source 463532cb8a2375d0319640a065f99819bc2386f7, tree 487f1dec6fce0d797fc8b9e0b7df0801b0834f88, with both #251 and #254 integrated. All five jobs passed.

  • All 17 new regression invocations passed on each supported macOS row, including CJK/emoji preservation, continuation splitting, clipping, empty/tail positions, styling/fill and alternate-screen routing.
  • Strict Swift formatting, Debug and universal Release builds, coverage, performance and golden gates passed.
  • Critical changed-line coverage: 3/3 (100%) on both rows. Production coverage: Sequoia 28,841/48,719 = 59.20%; Tahoe 28,903/48,719 = 59.33%, above the unchanged floors.
  • Each ordinary UI run reported 108 cases with zero failures and the same 26 intentional tour skips. Each separate strict tour executed all 26 successfully and exported/validated all 53 required screenshots.
  • Linux static/site checks passed. No gate, baseline, threshold or expected skip was relaxed.
  • Final read at 08:07 UTC on 2026-10-08 verified current main still d97d4e7b, unchanged PR head, a matching local staged/uploaded tree, and no merge conflict.

That prior head completed its earlier qualification. The refreshed head is now qualified by the exact-head run and tested merge recorded above. Draft status is preserved; no merge to main, release or deployment.

johnny4young and others added 7 commits October 7, 2026 23:01
- Repair truncated or split wide clusters with the current erase fill instead
  of an unstyled blank, so a right-margin truncation under background-color
  erase leaves no hole in a colored line.
- Cover the colored truncation case and insertion counts that reach or exceed
  the margin at a wide head.
- Build a headless continuation, a head whose continuation was overwritten, and
  a head at the margin by hand, so each repair branch runs under a colored pen
  and the changed lines carry coverage.
@johnny4young
johnny4young marked this pull request as ready for review October 8, 2026 22:29
@johnny4young
johnny4young merged commit e9c8d0a into main Oct 8, 2026
6 checks passed
@johnny4young
johnny4young deleted the fix/terminal-wide-insertion-oct08 branch October 8, 2026 22:29
johnny4young added a commit that referenced this pull request Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants