Skip to content

Support Shift+click to select a range#636

Open
liweitianux wants to merge 1 commit intolxqt:masterfrom
liweitianux:shift-click-selection
Open

Support Shift+click to select a range#636
liweitianux wants to merge 1 commit intolxqt:masterfrom
liweitianux:shift-click-selection

Conversation

@liweitianux
Copy link
Copy Markdown

When a start anchor selected, which may be by a plain click (char mode), a double click (word mode) or a triple click (line mode), another Shift+click extends the selection from the start anchor to the clicked position, which may be further extended in word and line mode. This range selection behavior is seen in most common terminals, including at least Konsole and VTE-based ones.

This patch is derived from an old version of Konsole, see commits:

While there, moved two comments to the right place.

Issue: lxqt/qterminal#818
Assisted-by: Claude Sonnet 4.6 (https://claude.ai/)

When a start anchor selected, which may be by a plain click (char mode),
a double click (word mode) or a triple click (line mode), another
Shift+click extends the selection from the start anchor to the clicked
position, which may be further extended in word and line mode.  This
range selection behavior is seen in most common terminals, including at
least Konsole and VTE-based ones.

This patch is derived from an old version of Konsole, see commits:
- Implement Shift+click to extend selection
  KDE/konsole@9a3d588
- Fix 'extend Selection' bug for apps not interested in mouse
  KDE/konsole@e5b7480

While there, moved two comments to the right place.

Issue: lxqt/qterminal#818
Assisted-by: Claude Sonnet 4.6 (https://claude.ai/)
@tsujan
Copy link
Copy Markdown
Member

tsujan commented Apr 23, 2026

Thank you very much for your PR!

Sadly, it covers only the visible part of the text when the start of the selection is below its end.

@liweitianux
Copy link
Copy Markdown
Author

Thank you very much for your PR!

You're welcome.

Sadly, it covers only the visible part of the text.

No. I opened another PR (#637) to address the scrolling/invisible screen issues, which happens to all other selection modes.

@tsujan
Copy link
Copy Markdown
Member

tsujan commented Apr 23, 2026

I opened another PR…

Oh, thanks! It'll need a thorough code review and test, as it's about a sensitive part of the code which may affect other parts unexpectedly. Fortunately there's enough time until the next release. So, please be patient and test them in various scenarios that may be related to text selection in any way (e.g., highlighting of found matches, URLs, …).

@tsujan
Copy link
Copy Markdown
Member

tsujan commented Apr 23, 2026

BTW, I also started to use both PRs until I find time for a code review. So far so good.

@liweitianux
Copy link
Copy Markdown
Author

Oh, thanks! It'll need a thorough code review and test, as it's about a sensitive part of the code which may affect other parts unexpectedly. Fortunately there's enough time until the next release. So, please be patient and test them in various scenarios that may be related to text selection in any way (e.g., highlighting of found matches, URLs, …).

Yeah, that PR touches some important logics, so a thorough code review is a must, and I'm very grateful.

However, most of the changes are ported from Konsole, with a very minor part assisted by the AI, so I have some confidence in the PR, although I'm a newbie to GUI and Qt programming :)

I also started using the patched qtermwidget on my working laptop, and so far so good.

Thank you for taking care of my PRs.

@tsujan
Copy link
Copy Markdown
Member

tsujan commented Apr 23, 2026

Keep up the good work! qterminal/qtermwidget needs contributors like you.

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.

2 participants