Skip to content

Conversation

@FastestMolasses
Copy link
Member

Description

There are 3 different selection modes that editors typically have when clicking and dragging the mouse.

  1. Character - simple click and drag to select by character
  2. Word - double click a word and then drag to start selecting by word ranges
  3. Line - triple click and drag to start selecting by entire lines

This PR tracks and implements the different selection mode behaviors.

Related Issues

Closes #74

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

Character selection (default behavior, unchanged)

Screen.Recording.2025-03-30.at.6.12.36.AM.mov

Double click for word selection

Screen.Recording.2025-03-30.at.6.14.26.AM.mov

Triple click for line selection

output.mov

@FastestMolasses FastestMolasses self-assigned this Mar 30, 2025
@FastestMolasses FastestMolasses added the enhancement New feature or request label Mar 30, 2025
Copy link
Contributor

@thecoolwinter thecoolwinter left a comment

Choose a reason for hiding this comment

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

Works like a charm, can I just request a small re-arrange? I dislike this new enum being in the TextSelection file (since that's a specific struct type and is unrelated).

Could we rename it to CursorSelectionMode and move it to it's own file?

@FastestMolasses
Copy link
Member Author

Updated!

Copy link
Contributor

@thecoolwinter thecoolwinter left a comment

Choose a reason for hiding this comment

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

Awesome!

@thecoolwinter thecoolwinter merged commit e86ca59 into main Mar 31, 2025
2 checks passed
@thecoolwinter thecoolwinter deleted the update_drag_selection branch March 31, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ Different Selection Modes When Dragging Mouse

3 participants