Skip to content

fix: collapse orphaned wide-char lead on trailing-column overlay#86

Open
natemoo-re wants to merge 3 commits into
mainfrom
nm/repro/wide-char-overlay
Open

fix: collapse orphaned wide-char lead on trailing-column overlay#86
natemoo-re wants to merge 3 commits into
mainfrom
nm/repro/wide-char-overlay

Conversation

@natemoo-re
Copy link
Copy Markdown
Member

@natemoo-re natemoo-re commented Jun 5, 2026

  • Fixes 🐛 Overlay onto a wide char's trailing column is dropped #75
  • Floating a narrow glyph onto the trailing column of an already-placed wide char dropped the overlay: the present loops advanced past the trailing column, so the wide char painted over both cells and the glyph was never emitted
  • present_cups and present_lines now detect a partial overwrite (a wide char whose trailing back-buffer cell holds a non-space glyph), collapse the orphaned lead to a space at width 1, and let the overlay glyph emit on the next column
  • Symmetric change in both present paths; rows without overlapping writes on wide chars stay byte-for-byte identical; cleanup only triggers on a detected overwrite
  • The regression lives in test/width.test.ts under describe("wide characters") rather than a standalone file. fix: cluster base + U+FE0F as a width-2 emoji glyph #84 also adds to test/width.test.ts (describe("emoji width")), so whichever merges second needs a trivial rebase to keep both describes
  • Test plan: deno test green (8 passed); deno lint + deno fmt --check clean

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 5, 2026

Open in StackBlitz

npm i https://pkg.pr.new/clayterm@86

commit: c12cd67

When a narrow glyph is floated onto the trailing column of an
already-placed wide char, the present loops skipped the trailing
column and the overlay was dropped (the wide char painted over both
cells). Detect the partial overwrite (non-space trailing cell) and
collapse the orphaned lead to a space at width 1 so the overlay glyph
emits. Applied symmetrically to present_cups and present_lines; rows
without overlapping writes stay byte-for-byte identical.

Fixes #75
@natemoo-re natemoo-re force-pushed the nm/repro/wide-char-overlay branch from b2240c3 to 7ebeb93 Compare June 5, 2026 06:14
@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented Jun 5, 2026

Merging this PR will degrade performance by 54.46%

❌ 1 regressed benchmark
✅ 22 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation long input burst (200 bytes) 576.1 µs 1,265 µs -54.46%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing nm/repro/wide-char-overlay (c12cd67) with main (48ff4bb)

Open in CodSpeed

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.

🐛 Overlay onto a wide char's trailing column is dropped

1 participant