Refactor TerminalSelection Anchors #6393

Closed
opened 2026-01-31 00:37:27 +00:00 by claunia · 0 comments
Owner

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

Originally assigned to: @carlos-zamora on GitHub.

Summary

The selection anchors are recorded strangely. We keep track of their position on the viewport, and where the viewport is at that time. Whenever we want to know what text these anchors cover or need to do more processing, we need to convert to the TextBuffer space, do what we wanted to do, then re-convert back to this weird system.

Additionally, the names _selectionAnchor and _endSelectionPosition could probably be better.

Technical Details

  1. The selection anchors should be in the TextBuffer coordinate system
  2. They should be renamed to something simpler and more cohesive (i.e.: _selectionStart and _selectionEnd)
  3. (Bonus Points!) If we can keep track of which one is higher/lower, that would make some code a lot easier.
Originally created by @carlos-zamora on GitHub (Feb 12, 2020). Originally assigned to: @carlos-zamora on GitHub. # Summary The selection anchors are recorded strangely. We keep track of their position on the viewport, and where the viewport is at that time. Whenever we want to know what text these anchors cover or need to do more processing, we need to convert to the TextBuffer space, do what we wanted to do, then re-convert back to this weird system. Additionally, the names `_selectionAnchor` and `_endSelectionPosition` could probably be better. # Technical Details 1. The selection anchors should be in the TextBuffer coordinate system 2. They should be renamed to something simpler and more cohesive (i.e.: `_selectionStart` and `_selectionEnd`) 3. (Bonus Points!) If we can keep track of which one is higher/lower, that would make some code a lot easier.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6393