Repository navigation
fix: measure narrow-field caret before hanging whitespace - #4767
Merged
Merged
Conversation
The Range after a hanging pre-wrap space extends beyond Chromium’s painted native caret. Check the last ink instead, retaining the narrow field and final-motion clipping coverage in both engines. The original case passes before #4714 and fails at that change; preserve its deliberate full-width draft layout. Closes #4755
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.
The narrow-field caret check treated a trailing space's DOM Range edge as the painted caret. With
pre-wrap, that space can hang outside the line while Chromium pulls its native caret back inside. The CI screenshot shows the caret inside the field despite the −2.421875px Range reading.The test now moves left across the trailing space before measuring, checking the caret beside the final ink. It keeps both engines, the narrow allocation, the clipping assertion, and the held final-motion frame from #4442. No runtime geometry changes.
The original Chromium case passes immediately before #4714 and fails at that change, which deliberately gives draft words Send's column under a mouse. It also fails on current main with the reported −2.421875px reading. Both Chromium and Firefox cases pass with this correction. This preserves #4714's layout choice rather than reserving extra room to satisfy a Range measurement.
Closes #4755 — automated triage