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

refactor: simplify double click selection #4898

Merged
merged 10 commits into from Oct 17, 2023

Conversation

kornes
Copy link
Contributor

@kornes kornes commented Oct 13, 2023

Selection has 2 modes, single click starts single character matching at cursor move and double click starts whole word matching at cursor move. This PR refactors double click selection to use simpler approach: creates unified selection between hovered word and starting word.

1a0b611 also fixes bug present on master, where double-click selection would move at each new message due to lack of index shifting. This could be separated PR but included it here for easier testing.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

src/messages/Selection.hpp Show resolved Hide resolved
src/messages/Selection.hpp Show resolved Hide resolved
src/widgets/helper/ChannelView.cpp Show resolved Hide resolved
src/widgets/helper/ChannelView.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@Nerixyz Nerixyz left a comment

Choose a reason for hiding this comment

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

Works as intended 👍

src/messages/Selection.hpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.cpp Show resolved Hide resolved
src/widgets/helper/ChannelView.cpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.hpp Show resolved Hide resolved
src/widgets/helper/ChannelView.hpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.cpp Outdated Show resolved Hide resolved
@pajlada
Copy link
Member

pajlada commented Oct 17, 2023

Could you record how to make the bug appear on master? I can't reproduce it

@kornes
Copy link
Contributor Author

kornes commented Oct 17, 2023

tested on release 2.4.6 (eb8c7f2d)

steps:

  1. start selection from double click on word
  2. left mouse click needs to be down (selecting)

@pajlada pajlada changed the title Ref: simplify double click selection refactor: simplify double click selection Oct 17, 2023
@pajlada pajlada merged commit 12808d3 into Chatterino:master Oct 17, 2023
15 checks passed
@kornes kornes deleted the ref_simplify-double-click-select branch October 17, 2023 17:33
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.

None yet

3 participants