Repository navigation
input: Measure the horizontal scroll extent from laid-out lines - #3604
Merged
huacnlee merged 2 commits intoOct 20, 2026
Merged
Conversation
The horizontal scroll range was sized from the line with the most UTF-8 bytes, and only that line was shaped. A shorter line with wider glyphs rendered past that width, so the scrollbar could not reach its end when soft wrap was disabled (longbridge#3529). The visible lines are already shaped during layout, so use their widest measured width as a lower bound alongside the byte-length candidate. Keep it in the existing per-document and per-style cache so the extent does not shrink when the wide line scrolls away; edits and font changes invalidate the cache as before.
YidaWeng
force-pushed
the
fix/input-horizontal-scroll-width
branch
from
October 20, 2026 04:25
0e581ee to
68b785f
Compare
huacnlee
previously approved these changes
Oct 20, 2026
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.
Closes #3529
Description
TextElementsized the horizontal scroll range from the line with the most UTF-8 bytes, and shaped only that line. A shorter line with wider glyphs can render past that width, so with soft wrap disabled the horizontal scrollbar stopped before the end of the line and the rest was unreachable.The visible lines are already shaped each frame, so the extent now takes their widest measured width as a lower bound alongside the byte-length candidate. The value stays in the existing per-document and per-style cache, so the extent does not shrink when the wide line scrolls out of view; edits and font changes invalidate it as before. Single-line inputs use the same path, and soft-wrapped inputs continue to use the viewport width.
Screenshot
Not applicable: the change is covered by a frame-stepped layout test.
How to Test
cargo test -p gpui-base --lib --features test-support horizontal_scroll_extent_covers_the_widest_laid_out_linee+ 200 combining marks) and a shorter, wider second line (W× 300). It scrolls fully right and asserts the caret at the end of the wider line lands inside the viewport. It repeats after editing the wider line toW× 400 and after growing the rem size from 16px to 24px. Without the fix the caret is left at x=1180px in a 240px viewport.cargo test -p gpui-base --lib --features test-support— 1432 passed.cargo test -p gpui-component --lib— 698 passed.cargo test -p gpui-kit --test integration --features "test-support,component"— 413 passed.cargo clippy -p gpui-base --all-targets --features test-support -- -D warnings— clean (only pre-existing workspace dependency warnings).cargo fmt --all -- --check.No public API changes.
Checklist
cargo runfor story tests related to the changes.