Fix line breaks being lost when copying after selection gesture in SelectableRegion#184043
Closed
Renzo-Olivares wants to merge 10000 commits into
Closed
Fix line breaks being lost when copying after selection gesture in SelectableRegion#184043Renzo-Olivares wants to merge 10000 commits into
Renzo-Olivares wants to merge 10000 commits into
Conversation
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.
Fixes #154253
Before this change the
_rectused by_SelectableFragmentwas calculated usinggetBoxesForSelectionwhich defaults to aBoxHeightStyleofBoxHeightStyle.tight. This style ensures the boxes returned fromgetBoxesForSelectiontightly wrap each character. This was causing an issue when text ended or was split on new lines because theSelectableFragment._rectdid not include the region that actually had the new lines. So when_SelectableFragmentinternally usedSelectionUtils.adjustDragOffsetto clamp the position to the selectable rect, the selectable rect is inaccurate and always results in a position that is above the new line and not on it.After this change the
_rectused by_SelectableFragmentis calculated usinggetBoxesForSelectionwith aBoxHeightStyleofBoxHeightStyle.max. This style ensures the boxes returned fromgetBoxesForSelectioncover the entire height of the line, and as a result including the new line character region.Other notes:
TextPainter.getBoxesForSelectionexplicitly notes that leading or trailing new line characters will be represented by zero-width boxes.Pre-launch Checklist
///).