Selection Expansion should not be occurring during Rendering #6284

Open
opened 2026-01-31 00:34:39 +00:00 by claunia · 0 comments
Owner

Originally created by @carlos-zamora on GitHub (Feb 4, 2020).

Originally assigned to: @carlos-zamora on GitHub.

This is a major bug, not because of what it's doing now, but how it's affecting other things.

How our selection model operates

Whenever we set a selection anchor (i.e.: pointer movements, search, etc), we are recording the COORD of the pointer or space that we want to select. If we encounter a wide glyph (i.e.: 😐) or are doing chunk selection for words/lines, the selection anchors are wrong and we expand to encompass them during _GetSelectionRects().

Issues this is causing

  1. #2447 Signaling for selection: the selection anchors we're returning are not representative of what gets selected.
  2. #3758 MoveSelectionAnchor: moving the selection anchors don't actually represent what is selected. So expanding by character on a double click selection really shows this.

Both of these issues are blocked until this gets resolved.

Proposed Approach

  • On click,
    • decide if this was a single/double/triple click
    • this establishes an expansion mode
    • set start/end at pointer
    • edit start/end based on expansion mode + glyphs
  • On drag,
    • if moving to the "right" of start, set end. Otherwise, set start.
    • from current cursor position, expand appropriately and update target endpoint
Originally created by @carlos-zamora on GitHub (Feb 4, 2020). Originally assigned to: @carlos-zamora on GitHub. This is a _major_ bug, not because of what it's doing _now_, but how it's affecting other things. ## How our selection model operates Whenever we set a selection anchor (i.e.: pointer movements, search, etc), we are recording the COORD of the pointer or space that we want to select. If we encounter a wide glyph (i.e.: 😐) or are doing chunk selection for words/lines, the selection anchors are wrong and we expand to encompass them during `_GetSelectionRects()`. ## Issues this is causing 1) #2447 Signaling for selection: the selection anchors we're returning are not representative of what gets selected. 2) #3758 MoveSelectionAnchor: moving the selection anchors don't actually represent what is selected. So expanding by character on a double click selection really shows this. Both of these issues are blocked until this gets resolved. ## Proposed Approach - On click, - decide if this was a single/double/triple click - this establishes an expansion mode - set start/end at pointer - edit start/end based on expansion mode + glyphs - On drag, - if moving to the "right" of start, set end. Otherwise, set start. - from current cursor position, expand appropriately and update target endpoint
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6284