Bug 374454 - Shift left click to extend selection doesn't preserve double or triple click mode
Summary: Shift left click to extend selection doesn't preserve double or triple click ...
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: copy-paste (show other bugs)
Version: master
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Sebastian
URL:
Keywords: investigated, triaged
: 346502 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-01-02 10:14 UTC by Glenn Coombs
Modified: 2018-11-11 15:08 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 18.12
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Glenn Coombs 2017-01-02 10:14:25 UTC
Using the following text as an example:

Konsole is a terminal program for KDE.

Double click on the "m" in terminal to make the initial selection. The entire word "terminal" is selected.

Now shift+left click on the "g" in program to extend the selection.  The selection should be extended so that it is set to "terminal program".  Instead what happens is that the selection is set to "inal prog".

I am running KDE Neon User Edition 5.8, which has Konsole version 16.12.0 installed.  After building the latest version of Konsole from git master (version 17.03.70) I can confirm that the same issue exists in that version.

I have modified the following lines in the TerminalDisplay::mousePressEvent function in TerminalDisplay.cpp:

	_lineSelectionMode = false;
	_wordSelectionMode = false;

so that they are only acted on if the click event has no modifier keys:

	if (!ev->modifiers()) {
		_lineSelectionMode = false;
		_wordSelectionMode = false;
	}

That fixes the behaviour for me.  It also appears to have fixed bug 346502 as well.
Comment 1 Sebastian 2018-10-30 22:21:10 UTC
*** Bug 346502 has been marked as a duplicate of this bug. ***
Comment 2 Sebastian 2018-10-30 22:24:38 UTC
Note: I am no maintainer but from the bugsquad.

I could reproduce this bug, as well as the duplicate you said.

I compiled your fix and it fixes both bugs as you said.

Do you want to push the fix to the repo?
If you need any help please let me know.

Please let me also know if you do not want to take the time to push it.

Thanks for the fix and report!
Comment 3 Glenn Coombs 2018-10-31 10:09:37 UTC
(In reply to Sebastian from comment #2)
> Note: I am no maintainer but from the bugsquad.
> 
> I could reproduce this bug, as well as the duplicate you said.
> 
> I compiled your fix and it fixes both bugs as you said.
> 
> Do you want to push the fix to the repo?
> If you need any help please let me know.
> 
> Please let me also know if you do not want to take the time to push it.
> 
> Thanks for the fix and report!

Hi Sebastian,

Thanks for the update.  I would love to have the fix in the repo so I don't have to keep my own version of Konsole around.  If you are able to push the fixes yourself I'm happy for you to do so.  If not, let me know and I'll have a go at pushing the changes myself.  I'm not entirely sure what exactly is required for that but hopefully the process is documented somewhere.
Comment 4 Sebastian 2018-10-31 10:18:31 UTC
To be honest I do not myself at the moment.
But this would be a good way to get to know the workflow of KDE infrastructure and workflow.

A good starting point would be 
https://community.kde.org/Infrastructure/Phabricator

Phabricator is used for patch review in KDE.

Seeing that you fixed the bug yourself and finding yourself around this codebase I guess KDE would benefit a lot from you coding :)
Comment 5 Glenn Coombs 2018-10-31 10:20:47 UTC
Okay, I'll read up on the process and try to push the fix.
Comment 6 Sebastian 2018-11-02 19:20:14 UTC
I hope you found your way through the documentation.

If not here are some additional infos I found:

(1) the official pharicator site: https://phabricator.kde.org/project/37/item/view/637/
(2) the repository: https://phabricator.kde.org/source/konsole/
Comment 7 Glenn Coombs 2018-11-04 11:14:12 UTC
Thanks, yes I successfully created a Phabricator account and posted the diff for review.
Comment 8 Kurt Hindenburg 2018-11-11 15:06:02 UTC
Git commit e2167eb0674ef93f0e2a1df9aaa54a9e0a3cd6d3 by Kurt Hindenburg, on behalf of Glenn Coombs.
Committed on 11/11/2018 at 15:05.
Pushed by hindenburg into branch 'master'.

Preserve double/triple click mode when extending the selection

Summary:
When extending the selection using the mouse the double or triple click
mode that initiated the selection should be preserved.  If the user double
clicked to select a word, then extending the selection should extend
"word at a time" rather than "character at a time". Similarly if the user
triple clicked to select a whole line initially, then extending the selection
should extend "line at a time" rather than "character at a time".
FIXED-IN: 18.12

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D16660

M  +4    -2    src/TerminalDisplay.cpp

https://commits.kde.org/konsole/e2167eb0674ef93f0e2a1df9aaa54a9e0a3cd6d3
Comment 9 Kurt Hindenburg 2018-11-11 15:08:28 UTC
Git commit f508ed8632f66f960636250ced756c0d90300227 by Kurt Hindenburg, on behalf of Glenn Coombs.
Committed on 11/11/2018 at 15:07.
Pushed by hindenburg into branch 'Applications/18.12'.

Preserve double/triple click mode when extending the selection

Summary:
When extending the selection using the mouse the double or triple click
mode that initiated the selection should be preserved.  If the user double
clicked to select a word, then extending the selection should extend
"word at a time" rather than "character at a time". Similarly if the user
triple clicked to select a whole line initially, then extending the selection
should extend "line at a time" rather than "character at a time".
FIXED-IN: 18.12

Reviewers: #konsole, hindenburg

Reviewed By: #konsole, hindenburg

Subscribers: konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D16660

(cherry picked from commit e2167eb0674ef93f0e2a1df9aaa54a9e0a3cd6d3)

M  +4    -2    src/TerminalDisplay.cpp

https://commits.kde.org/konsole/f508ed8632f66f960636250ced756c0d90300227