text: Fix correct TextView selection when dragging back to the anchor line#2112
Merged
huacnlee merged 1 commit intolongbridge:mainfrom Mar 6, 2026
Merged
Conversation
Member
|
Thank you. |
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 #2111
Description
Fix
TextViewselection when dragging back to the original line after crossing another line. The selection helper now treats points within the same rendered line as a single-line selection, so the highlight stays bounded by the anchor and current cursor positions. This also adds regression tests for the same visual line with differentypositions.AI-generated portions reviewed for accuracy: the selection helper adjustment and the regression tests in
crates/ui/src/text/inline.rs.Screenshot
Before
2026-03-03.19.10.59.mov
After
2026-03-03.19.07.05.mov
How to Test
cargo test -p gpui-component test_point_in_text_selection --lib.TextView, start a selection on one line, drag to the next line, then move back to the original line.Checklist
cargo runfor story tests related to the changes.