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

Make mouse click extend selection in select mode #5436

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

xJonathanLEI
Copy link
Contributor

Resolves #5425. Design rationale detailed in #5425 comments.

I'm not entirely sure whether this change is desired, but am still submitting this optimistically as I think it makes a lot of sense. I use Helix on a touch screen device (phone) sometimes and find this extremely useful for selecting code blocks as touches are easier to do than key strokes on such devices. It annoys me that currently the only way to extend a selection would be to use a keyboard.

This PR should improve the mouse UX. It's now possible to extend the primary selection with mouse clicks. The original drag-to-yank behavior is also retained.

With this PR, the editor no longer collapses all selections into a single point on mouse clicks unconditionally. Instead, it extends the primary selection to the point click when it's in select mode (secondary selections are still discarded for consistency). Normal mode behavior is left untouched.

@the-mikedavis the-mikedavis added A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer. labels Jan 8, 2023
@kirawi kirawi added the R-breaking-change This PR is a breaking change for some behavior label Jan 10, 2023
@xJonathanLEI
Copy link
Contributor Author

Conflicts with #5420. Rebased.

@xJonathanLEI
Copy link
Contributor Author

Regarding the R-breaking-change label, I'd actually argue that the current behavior of not extending the selection in select mode is a bug :)

@archseer archseer added this to the next milestone Jan 25, 2024
@archseer archseer removed the R-breaking-change This PR is a breaking change for some behavior label Jan 25, 2024
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

Sorry for the delay - I've been meaning to look at this for a while. The change itself looks good and the behavior feels right. I just have one small nit

helix-term/src/ui/editor.rs Outdated Show resolved Hide resolved
@the-mikedavis the-mikedavis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from a maintainer. labels Feb 18, 2024
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

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

Thanks!

@the-mikedavis the-mikedavis added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 19, 2024
@pascalkuthe pascalkuthe merged commit cdef4f8 into helix-editor:master Feb 19, 2024
6 checks passed
uek-1 pushed a commit to uek-1/helix that referenced this pull request Feb 24, 2024
* Make mouse click extend selection in select mode

* chore: better readability with `Option::take()`
shortc pushed a commit to shortc/helix that referenced this pull request Mar 31, 2024
* Make mouse click extend selection in select mode

* chore: better readability with `Option::take()`
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 4, 2024
* Make mouse click extend selection in select mode

* chore: better readability with `Option::take()`
mtoohey31 pushed a commit to mtoohey31/helix that referenced this pull request Jun 2, 2024
* Make mouse click extend selection in select mode

* chore: better readability with `Option::take()`
Vulpesx pushed a commit to Vulpesx/helix that referenced this pull request Jun 7, 2024
* Make mouse click extend selection in select mode

* chore: better readability with `Option::take()`
smortime pushed a commit to smortime/helix that referenced this pull request Jul 10, 2024
* Make mouse click extend selection in select mode

* chore: better readability with `Option::take()`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mouse click should extend selections in select mode
5 participants