Repository navigation
Conversation
T-miracle
marked this pull request as ready for review
October 26, 2026 01:04
Member
|
I've prepared a fix for the oversized-word measurement regression in 54a6eee. It bounds word-boundary probes and falls back to local grapheme probing for long words. All 20 related tests, Clippy, formatting and diff checks passed. Please cherry-pick it onto this PR: git fetch https://github.com/longbridge/gpui-kit.git fix/pr-3691-local-wrap-measurements
git cherry-pick 54a6eeeb32e25857e1b6a8c6c91c2802bd90dc5cFor future PRs, please enable Allow edits from maintainers so we can push follow-up fixes directly to your branch. This PR currently has that option disabled, and GitHub rejected the push with |
Limit word-boundary probes to a local grapheme window. Fall back to the original exponential grapheme search when a candidate lies beyond it, preserving legal word boundaries and conservative width reuse intervals. Add a regression that compares original wrapping and bounds shaped bytes for 8K/16K words, narrow and wide viewports, leading words and both indentation modes. AI-assisted implementation and regression validation. (cherry picked from commit 54a6eee)
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.
Description
Dragging a divider beside a soft-wrapped editor can lag because each width change measures the document again.
Reuse valid line breaks and exact measured text widths. Lines rewrap immediately when their breaks change, so wrapping stays live throughout the drag.
Integrated main (
7b14e03), including #3622's Tab measurements. Changing the tab size clears cached measurements and recalculates wrapping.Four Base input files; no public API or dependency changes. The width cache holds up to 32,768 entries and 4 MiB of text, plus bookkeeping overhead.
Screenshot
Real Windows native editor recordings, captured separately with the same 1,500-line drag test. Original speed, 25 fps; only startup waiting, framing and English labels were edited. This recording predates the main integration.
How to Test
Open a soft-wrapped editor with long text and tabs, then drag its divider back and forth. Wrapping should update during the drag; changing font or tab size must recalculate it.
Windows validation on the updated branch:
--all-targets --deny warnings) passed.cargo test -p gpui-base -p gpui-component -p gpui-kit -p gpui-component-story \ --features gpui-component-story/test-support --lockedEarlier CPU resize-and-draw measurements on the fixed 0.8.0 baseline and original patch, Windows Release/native fonts/1,500 lines:
These used 32 measured samples after four warm-up samples, without recording. They are historical CPU timings; current-main and macOS/Linux performance numbers have not been measured.
Merge Danger
Reversible internal optimization. Wrapping affects caret, selection and inline layout; large wrap changes can still cause slow frames.
Implementation, tests, description and recording preparation were AI-assisted.
Checklist