Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi-click selections #1268

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Kneemund
Copy link
Collaborator

@Kneemund Kneemund commented Oct 29, 2024

Adds multi-click selection within typewriter text fields, mimicking the behavior of most text editors/browsers.

  • Fixes Double click to select word and sentences in the text? #872.
  • Double click to select the current word. Drag after the second click to extend the selection onto other words.
  • Triple click to select the current line. Drag after the third click to extend the selection onto other lines.
  • Cycles through selection modes (caret, word, line) in case of more than 3 clicks.

TODO

  • Performing a double click selection while hovering over whitespace will select the next word, but immediately expand the selection backwards onto the previous word (i.e. cover two words). This is nearly identical to the behavior of Firefox; the only difference being that Firefox only expands the selection after the mouse is moved in any way. Chromium and GNOME Text Editor simply select the whitespace because they generally snap the selection to any word boundary (start and end). I'd personally prefer the way Chromium/GNOME Text Editor handles this. EDIT: Switched to the Chromium variant.
  • The caret blink is always reset if the mouse moves, even if the selection doesn't change. This has been the case before but is more noticeable with multi-click selections, since the selections change less often. Not sure what the intended behavior is. EDIT: Cursor blink is now only reset if the position changes.
  • The gesture used for detecting multiple button presses is currently always enabled and has a generic name. It could either be tailored to this feature specifically and disabled when the typewriter tool is not selected, or an early return could be added (keeping it generic enough for potential future features that make use of the gesture).

@Kneemund Kneemund changed the title feature: multi-click selections feat: multi-click selections Oct 31, 2024
@Kneemund Kneemund marked this pull request as ready for review November 10, 2024 00:09
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.

Double click to select word and sentences in the text?
1 participant