Skip to content

Fix: selection handle horizontal drag stays on current line#2731

Open
Alspb wants to merge 2 commits into
singerdmx:masterfrom
Alspb:fix/selection-handle-drag-wrong-line
Open

Fix: selection handle horizontal drag stays on current line#2731
Alspb wants to merge 2 commits into
singerdmx:masterfrom
Alspb:fix/selection-handle-drag-wrong-line

Conversation

@Alspb

@Alspb Alspb commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Description

Fixed: Dragging the right selection handle horizontally extends the selection into the line below instead of staying on the current line.

_handleDragUpdate was resolving the text position from the raw details.globalPosition, which lies below the line the
handle anchors to.
The fix was introduced previously in 6b9795a: _dragPosition += details.delta includes the necessary adjustment. This fix was later reverted for some reason. Restoring it.

Type of Change

  • Feature: New functionality without breaking existing features.
  • 🛠️ Bug fix: Resolves an issue without altering current behavior.
  • 🧹 Refactor: Code reorganization, no behavior change.
  • Breaking: Alters existing functionality and requires updates.
  • 🧪 Tests: New or modified tests
  • 📝 Documentation: Updates or additions to documentation.
  • 🗑️ Chore: Routine tasks, or maintenance.
  • Build configuration change: Build/configuration changes.

Copilot AI review requested due to automatic review settings May 15, 2026 06:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores adjusted drag-position handling for text selection handles so horizontal dragging resolves the text position from the handle anchor rather than the raw pointer position.

Changes:

  • Tracks _dragPosition during handle drag updates and uses it for getPositionForOffset.
  • Removes the now-obsolete unused-field ignore.
  • Adds an Unreleased changelog entry for the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lib/src/editor/widgets/text/text_selection.dart Restores adjusted drag position usage for selection handle drag updates.
CHANGELOG.md Documents the selection handle drag fix under Unreleased.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

_dragPosition += details.delta;
final position =
widget.renderObject.getPositionForOffset(details.globalPosition);
final position = widget.renderObject.getPositionForOffset(_dragPosition);
Comment thread CHANGELOG.md

### Fixed

- Fixed dragging the right selection handle horizontally extends the selection into the line below instead of staying on the current line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants