Repository navigation
fix(tui): preserve graphemes and terminal display columns - #14919
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
CI triage — draft, not merge-readyI converted this PR back to draft while distinguishing inherited failures from unresolved execution results. Local focused tests passing did not establish an all-green CI result. The tested merge commit is
Remaining uncertaintyOf 74 gap regressions collected so far, 67 have exactly matching case status and printed failure detail on main-parent CI runs
Main's third gap shard is stopped by a runner shutdown before reaching these cases, so absence from that log does not prove they pass or fail on main. The PR's sixth gap shard also receives a shutdown signal (exit 143), and the WASI component execution job is still pending at this audit. I am not labelling all red checks as inherited or declaring this PR safe to merge from these partial observations. No unrelated source fixes, snapshot acceptance, baseline increases, or gate suppression are included. |
|
CI repair work is now submitted as separate changes, rather than stopping at identifying inherited failures:
Existing independent repairs such as #14871 (warnings), #14874 (release fixture), #14875 (Windows SDK), and #14878 (WASM ABI) are not duplicated here. The remaining gap/GC/debt and inventory results still need their own resolution; this PR remains draft and is not declared merge-ready. |
raliclo
left a comment
There was a problem hiding this comment.
Tested this on macOS 27.3 arm64 (pinned nightly-2026-10-04), merged onto current main. Notes below; I didn't find a correctness problem in the grid/diff changes.
1. The stock TUI command now runs on macOS without a shim.
Your test plan marks RUST_TEST_THREADS=1 cargo test --locked --profile perry-dev -p perry-runtime --lib tui:: -- --test-threads=1 as blocked on macOS by the ELF snapshot symbols. Since #14931 declared those symbols on Linux only, it links and runs as-is:
| build | result |
|---|---|
main 90e338d |
83 passed, 0 failed, 2 ignored |
main + this PR (d18cea1), merge 979fd2b1bf |
98 passed, 0 failed, 2 ignored |
The 15 extra tests are this PR's own; the 2 ignored are reader_lifecycle_child and registry_scaling_benchmark, the same on both sides.
2. It merges cleanly onto current main, and your CI fixes have landed.
#14928, #14929, #14930 and #14932 are all merged now, and this branch is 187 commits behind. A rebase should drop several of the inherited reds you triaged, which would make the remaining CI picture much easier to read.
3. A frame-cost number would help with the Cell change.
Cell goes from a 16-byte Copy value to roughly twice that, with Option<Arc<str>>, and flush moves from copy_from_slice to clone_from_slice. I'd expect that to be negligible at terminal sizes, but the only benchmark in the module (registry_scaling_benchmark) covers the tree registry, not diff/flush. A before/after timing for a full-screen repaint and an unchanged frame (say 200×80) would settle it.
4. FYI, no action needed: control characters keep their width.
I wondered whether the width == 0 → skip path would drop control characters. With unicode-width 0.2.2, \t, \n, \r, ESC, NUL, BEL and DEL each measure 1, as before. The only difference from the old per-char loop is that \r\n is one grapheme, so it takes 1 column instead of 2. Only true zero-width text, like ZWSP or a soft hyphen, is now skipped.
d18cea1 to
51e35a5
Compare
Summary
Measure and paint
perry/tuitext in terminal columns while retaining complete extended grapheme clusters. This fixes CJK/emoji layout, combining-mark updates, right-edge clipping, and stale columns after wide-to-narrow replacements.Changes
unicode-segmentationdependency and the already-lockedunicode-width 0.2.2for one consistent non-CJK width policy in layout and painting.CellbecomesClonerather thanCopyand carries grapheme/width metadata; the former 16-byte-cell claim no longer applies.Scope: no multiline/wrapping implementation, configurable ambiguous-width policy, cross-widget grapheme joining, or widget-lifetime changes. Leading zero-width graphemes without a base are omitted. Unicode/width-policy differences between terminal emulators remain possible and are documented.
Related issue
n/a. Checked all open upstream PRs and searched TUI/Unicode/grapheme/width topics before starting; none overlaps this fix. Widget ownership remains the separate #11919 workstream.
Test plan
CARGO_HOME=<task-cache> CARGO_TARGET_DIR=<task-target> cargo check --locked --offline --profile perry-dev -p perry-runtime --tests— passes on macOS arm64, pinnednightly-2026-10-04, with pre-existing warnings.rustfmt --check,git diff --cached --check,python3 scripts/check_test_registration.py, andpython3 scripts/tokio_inventory.py --offlinepass.python3 scripts/lock_no_downgrade.py --vs origin/main— no resolved package/version changes, only the new runtime dependency edge to an already-locked crate.RUST_TEST_THREADS=1 cargo test --profile perry-dev -p perry-runtime --lib tui:: -- --test-threads=1on macOS arm64 after rebasing onto currentmain(no shim needed since fix(runtime): declare the ELF image symbols on Linux only, so perry-runtime's lib tests link on macOS #14931): 101 passed, 0 failed, 1 ignored.CARGO_NET_OFFLINE=true SKIP_COMPILE_GATES=1 BASE_SHA=origin/main bash scripts/run_lint_gates.sh— 17/142 fail, 2 CI-only arms skipped, compile tier explicitly skipped. A clean detached clone at base1bf3c0e8runs the same runner withBASE_SHA=HEADand reports the same 17 failing commands, with no new failures. Existing failures cover release-pipeline fixtures, rustup/CARGO_HOME and missing cargo-xwin, unrelated formatting/file-size drift, address/string/GC inventories, WASM ABI currency, and debt/global-sink ledgers. No full-lint pass is claimed.e2e-scopedfailure reproduces byte-for-byte on pristine1bf3c0e8:python3 scripts/ci_e2e_scope.py --self-testexpects thesnap_image_literal_ordersuite twice. This PR changes neither the scope script nor that suite.cargo-testexecutes all TUI unit tests: 98 passed, 0 failed, 2 ignored. The job subsequently fails in the CLI build-cache audit, not a TUI test. See the PR job.main; CI is re-running.scripts/check_file_size.shfails locally on files this PR does not touch (same onmain).f54495f1CI (runs44091250261and44097228628). Seven remain unclassified because main's third shard receives a runner shutdown before reaching them:test_gap_v8_heap_snapshot_4916,test_gap_stack_runtime_frames,test_gap_typed_array_number_key_plain_site,test_gap_dyncode_direct_eval_patches_methods.cjs,test_gap_native_namespace_enumeration_nskeys.cjs,test_gap_net_constructor_class_identity, andtest_gap_native_payload_zlib_one_shots. Both failing GC matrix subjects (repsel_p4a3_numarray_barriersandgc_namespace_and_computed_dispatch_rooting) also fail in the exact main-parent rerun. No snapshot or debt baseline is raised here to hide these failures.wasi-componentsstopping at the stale Rust-host fixture-path assertion. A passing build is not a passing execution test.CI repair follow-ups
Confirmed CI defects found during this review are being fixed independently: #14928 removes the duplicate e2e suite registration (the upstream
e2e-scopedjob now passes on that PR); #14929 adds the two missing compiler cache inputs (all 53 actual CLI cache tests pass locally); #14930 upgrades ZIP to the patched 9.0.5 release (official RustSec audit exits 0 and all 22 updater tests pass locally); #14932 fixes WASI guest-host fixture preparation (the new regression fails before the fix and the eight-test qualification suite passes afterward). These PRs do not establish that the remaining gap/GC/inventory failures are resolved.Upstream verification:
cargo-testis green on #14929, andsecurity-audit / security-auditis green on #14930. Together with #14928's greene2e-scopedresult, these are observed CI outcomes, not just local predictions.Checklist
CHANGELOG.mdedits, no raised debt baselines.changelog.d/14919-tui-unicode-columns.mdusing the assigned PR number.Summary by CodeRabbit