Repository navigation
[CTX-1367] fix(ui): include zerowidth scalars in copied text - #2266
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Xuepoo
pushed a commit
that referenced
this pull request
Oct 19, 2026
Fix bitty#2261. The paste bytes were already delivered exactly once; the duplicate first token and the Ctrl+C ghost were frame/cursor damage. Root cause: CUF/CUB counted a wide pair's trailing spacer as an extra column. In fish's two-pass bracketed-paste repaint, CUF 43 landed on 47; the subsequent CUB 8 ran on a spacer-free row and landed on 39 instead of 35, so the redraw appended `abc` four columns past the first paint and left the original cell behind. - bitty-term-state: cursor moves are O(1) `col +/- n` with a lead snap when the destination is a spacer; the requested column count is never inflated. - bitty-runtime: ZWJ/ZWNJ are cluster joiners, not bidi controls; real bidi controls still gate, and ZWSP/WORD JOINER/BOM keep a separate `zero-width` reason (P0-AC-008 unchanged). - Copy-side zerowidth emission is already on `main` via #2266 (`Cell::push_text_into`); this branch carries only the cursor-move clamp and the paste-inspection narrowing, so the rebase drops the duplicate bitty-ui edits. Render scope: unshaped mark painting is not part of this change. CTX-1371 owns it, emitting each visible mark at the font pen origin (`col*cell_width + base_advance + mark.left`), skipping join controls / selectors / tag scalars, and proving `e` + U+0301 byte-identical to precomposed U+00E9. This branch keeps `present_golden` at its parent digest and touches no `bitty-render` paint path. Merge order: CTX-1368 lands first; CTX-1371 rebases and adds marks (with the `wide_combining` re-record). Regression: crates/bitty-runtime/tests/paste_confirm_frame.rs replays the recorded shell repaint. With only `state.rs` reverted it fails with `> abc abc`; with the fix it passes (`> abc`), the incremental surface equals one full replay, and banner dismissal pixels equal a never-armed runtime. Gates: fmt, workspace clippy -D warnings, nextest term-state/ui/runtime/ terminal, Windows all-targets. Evidence in recording/ctx-1368-paste-duplication/ (gitignored scratch).
Xuepoo
added a commit
that referenced
this pull request
Oct 19, 2026
…2261) (#2272) * [CTX-1368] fix(term-state): clamp cursor moves across wide spacers Fix bitty#2261. The paste bytes were already delivered exactly once; the duplicate first token and the Ctrl+C ghost were frame/cursor damage. Root cause: CUF/CUB counted a wide pair's trailing spacer as an extra column. In fish's two-pass bracketed-paste repaint, CUF 43 landed on 47; the subsequent CUB 8 ran on a spacer-free row and landed on 39 instead of 35, so the redraw appended `abc` four columns past the first paint and left the original cell behind. - bitty-term-state: cursor moves are O(1) `col +/- n` with a lead snap when the destination is a spacer; the requested column count is never inflated. - bitty-runtime: ZWJ/ZWNJ are cluster joiners, not bidi controls; real bidi controls still gate, and ZWSP/WORD JOINER/BOM keep a separate `zero-width` reason (P0-AC-008 unchanged). - Copy-side zerowidth emission is already on `main` via #2266 (`Cell::push_text_into`); this branch carries only the cursor-move clamp and the paste-inspection narrowing, so the rebase drops the duplicate bitty-ui edits. Render scope: unshaped mark painting is not part of this change. CTX-1371 owns it, emitting each visible mark at the font pen origin (`col*cell_width + base_advance + mark.left`), skipping join controls / selectors / tag scalars, and proving `e` + U+0301 byte-identical to precomposed U+00E9. This branch keeps `present_golden` at its parent digest and touches no `bitty-render` paint path. Merge order: CTX-1368 lands first; CTX-1371 rebases and adds marks (with the `wide_combining` re-record). Regression: crates/bitty-runtime/tests/paste_confirm_frame.rs replays the recorded shell repaint. With only `state.rs` reverted it fails with `> abc abc`; with the fix it passes (`> abc`), the incremental surface equals one full replay, and banner dismissal pixels equal a never-armed runtime. Gates: fmt, workspace clippy -D warnings, nextest term-state/ui/runtime/ terminal, Windows all-targets. Evidence in recording/ctx-1368-paste-duplication/ (gitignored scratch). * [CTX-1368] docs(runtime): correct the paste reason-token bound * [CTX-1368] test(runtime): prove the banner paints and cover the remaining classes --------- Co-authored-by: reviewer <[email protected]>
Xuepoo
added a commit
that referenced
this pull request
Oct 20, 2026
Cover the full `v0.0.23..main` range instead of the earlier partial passes: all 71 merged commits are grouped under Added, Changed, Fixed, Security, and Documentation, with PR numbers and the affected CTX tasks. Explicit call-outs: copy keeps combining marks and ZWJ (#2266), multi-line paste duplication and ghost fixed by the cursor clamp across wide spacers (#2272), combining marks paint so decomposed `é` matches precomposed (#2279), kitty font query and `bitty +show-font` (#2277), bounded native clipboard acquisition path B (#2273), bounded `bitty.fs.list` (#2271), the `bitty.history` Lua surface (#2268), the production ComponentBroker plus activation state (#2267, #2276), Enter-confirm paste (#2269), the `fill` DPI fix (#2283), landlock `no_new_privs` (#2284), and spawn descriptor reservation (#2289). Partials are marked honestly: #2254's request surface is still pending, the #2213 disposition stays open, #2286 is feature-gated and unwired, the macOS clipboard read stays a typed refusal, and the RC-1 fuel accounting fix is not claimed because PR #2292 is unmerged. The heading reads `unreleased` because the release is on hold; the tag date is set at tag time. Docs-only: no code, scripts, workflows, or pins touched.
Xuepoo
added a commit
that referenced
this pull request
Oct 20, 2026
Cover the full `v0.0.23..main` range instead of the earlier partial passes: all 71 merged commits are grouped under Added, Changed, Fixed, Security, and Documentation, with PR numbers and the affected CTX tasks. Explicit call-outs: copy keeps combining marks and ZWJ (#2266), multi-line paste duplication and ghost fixed by the cursor clamp across wide spacers (#2272), combining marks paint so decomposed `é` matches precomposed (#2279), kitty font query and `bitty +show-font` (#2277), bounded native clipboard acquisition path B (#2273), bounded `bitty.fs.list` (#2271), the `bitty.history` Lua surface (#2268), the production ComponentBroker plus activation state (#2267, #2276), Enter-confirm paste (#2269), the `fill` DPI fix (#2283), landlock `no_new_privs` (#2284), and spawn descriptor reservation (#2289). Partials are marked honestly: #2254's request surface is still pending, the #2213 disposition stays open, #2286 is feature-gated and unwired, the macOS clipboard read stays a typed refusal, and the RC-1 fuel accounting fix is not claimed because PR #2292 is unmerged. The heading reads `unreleased` because the release is on hold; the tag date is set at tag time. Docs-only: no code, scripts, workflows, or pins touched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Priority: P1 | Area: area:ui | Labels: fix,P1,area:ui | Milestone: 0.0.24 | RFC: CR-TERM-01 | Task: CTX-1367
What & why
Copy, accessibility runs, inspection text, session scrollback capture, view text, and URL detection pushed only
Cell::glyph.Cell::zerowidthholds combining marks, ZWJ, and variation selectors, so a decomposedé(e+ U+0301) copied aseand a family emoji copied as four separate people.This adds
Cell::push_text_into(glyph followed by every retained zero-width scalar in arrival order) and routes all seven text-extraction surfaces through it. Cell storage,MAX_ZEROWIDTH_CHARS(5), spacer semantics, and the paint/shaping path are unchanged.Closes #2260
Scope
crates/bitty-term-state/src/cell.rs— newpush_text_intohelper + unit test; no storage change.crates/bitty-ui/src/selection.rs— selection range, block, and persistent-selection text (copy path).crates/bitty-ui/src/a11y.rs— accessibility text runs.crates/bitty-ui/src/view.rs—visible_text_rowsprojection.crates/bitty-runtime/src/inspect.rs— grid text; the post-trim scalar truncation is removed so a mark cannot be cut off the last cell, and the bound stays a cell bound.crates/bitty-runtime/src/runtime/session.rs— scrollback tail text.crates/bitty-runtime/src/runtime/plaintext_url.rs— row reconstruction; the byte map keeps one entry per glyph plus one per mark, so span anchoring is unchanged.e+U+0301, four-cell ZWJ family (Selection::textandblock_text), variation selector, regional-indicator pair, a11y baseline, inspect grid text, view visible text, URL decomposed-prefix anchoring.Rendering is untouched: no
crates/bitty-render/**changes.Mutation evidence
Mutation probe on an independent copy of this head with
push_text_intoreduced toout.push(self.glyph)(log:recording/ctx-1367-copy-zerowidth/review/mutation.log):bitty-term-state --lib push_text_into_emits_glyph_then_marks_in_order— FAILEDbitty-ui --lib selection_text_keeps_decomposed_combining_mark— FAILEDbitty-ui --lib selection_text_keeps_zwj_family_cluster_across_spacers— FAILEDbitty-ui --lib selection_text_keeps_variation_selector— FAILEDbitty-ui --lib visible_text_rows_keeps_zero_width_scalars— FAILEDbitty-ui --test a11y_baseline terminal_runs_keep_zero_width_scalars— FAILEDbitty-runtime --lib grid_text_keeps_zero_width_scalars— FAILEDbitty-runtime --lib decomposed_prefix_shifts_bytes_past_columns— FAILEDThe regional-indicator test passes under the mutation by design: regional indicators are leading glyphs, not zero-width scalars.
Multi-line exactness
Rows printed through
TerminalAction::Print/ControlChar, then read back via drag copy, line drag, persistent selection, a11y runs, and inspect grid text (all five identical bytes):Copied text:
Asserted: exact bytes (decomposed
épreserved, no Unicode normalization),!text.starts_with(' '),text.matches("abc").count() == 1(first line not duplicated),text.lines().count() == 4, block copy of the emoji row0..7 == 👨👩👧👦.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --locked -- -D warnings(plus-p bitty-terminal --features dev-tools)cargo nextest run -p bitty-ui -p bitty-runtime -p bitty-term-state -p bitty-terminal --lockedcargo check --workspace --all-targets --locked(x86_64-pc-windows-gnu,RUSTFLAGS=-D warnings)Checklist
Non-blocking residuals (follow-ups, not merge blockers)
INSPECT_MAX_COLSandGridTextSnapshotdoc comments still describe a char-based bound; rows now hold up tomax_colscells (up tomax_cols * (1 + MAX_ZEROWIDTH_CHARS)scalars). Documentation drift only — consumers bound by the cell window and the IPC service re-bounds by bytes.scrollback_tail_textuses the helper but no test feeds a combining mark through capture/restore, so a regression there would not fail the suite (every other converted surface is mutation-sensitive). Needs a capture-side test next torestore_scrollback_text_handles_wide_and_control_scalars.0..1of the family emits a trailing ZWJ. This is inherent to cell-granular extraction and matches the pre-existing boundary behavior; not introduced here. Cluster-aware trimming would be a separate design change.Independent review: APPROVE at
cfd695a2(reviewer1367-reviewer); verdict atrecording/ctx-1367-copy-zerowidth/review/verdict.md.