Bug 463268 - Double-click to copy, then leaving konsole tab quickly (using keyboard?), does not copy text
Summary: Double-click to copy, then leaving konsole tab quickly (using keyboard?), doe...
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: copy-paste (show other bugs)
Version: master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Matan Ziv-Av
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-20 14:47 UTC by Andreas Hartmetz
Modified: 2023-02-08 15:59 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Hartmetz 2022-12-20 14:47:56 UTC
STEPS TO REPRODUCE
1. Double-click-select text in a konsole tab
2.a VERY quickly use a keyboard shortcut to switch to another konsole tab (Ctrl-left/right arrow for me)
2.b Using alt-tab to switch to another window entirely also reproduces the bug (let's say I want to paste a commit hash from konsole into this browser window with Bugzilla...)
3. Middle-click paste text

OBSERVED RESULT
The pasted text is what was in the middle-click buffer before step 1

EXPECTED RESULT
The pasted text is what was selected in step 1

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: master
KDE Frameworks Version: master
Qt Version: kde/5.15 from a few weeks ago

ADDITIONAL INFORMATION
This bug triggers more often for me than one might think. Seems like I tend to copy and tab away quickly.
Because timing matters and it's new, I guess it's a bug in 0752cf3d6261d60bbb20a62194556b2377548368.
Comment 1 Andreas Hartmetz 2022-12-20 14:50:46 UTC
Correction: Shift-left/right arrow, not Ctrl-left/right arrow (the default IIRC)
Comment 2 Andreas Hartmetz 2022-12-20 15:01:22 UTC
Another way to reproduce: double-click to copy something from "git log", then quickly close the git log with q. Also doesn't copy.
Comment 3 Bug Janitor Service 2022-12-23 16:31:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/793
Comment 4 Andreas Hartmetz 2022-12-23 22:05:20 UTC
(In reply to Bug Janitor Service from comment #3)
> A possibly relevant merge request was started @
> https://invent.kde.org/utilities/konsole/-/merge_requests/793

That one seems to fix it, thanks!
Comment 5 Andreas Hartmetz 2022-12-24 11:04:54 UTC
Ah well, there's another thing: double-click to select quickly followed by middle click to paste pastes the selection from before the immediately preceding double-click.
Comment 6 Matan Ziv-Av 2022-12-24 22:05:21 UTC
(In reply to Andreas Hartmetz from comment #5)
> Ah well, there's another thing: double-click to select quickly followed by
> middle click to paste pastes the selection from before the immediately
> preceding double-click.

I believe that the updated MR 793 should now handle this, both if the triple click is in the same konsole, or in another.
Comment 7 Bug Janitor Service 2023-01-03 21:27:38 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/799
Comment 8 Andreas Hartmetz 2023-02-08 15:59:44 UTC
Git commit b238fb29cf9fe061df8c79b07f5126346bff9c88 by Andreas Hartmetz, on behalf of Matan Ziv-Av.
Committed on 08/02/2023 at 15:56.
Pushed by ahartmetz into branch 'master'.

Fix bug in double-click selection

A bug introduced in 0752cf3d prevents copying selection to clipboard if
a key is pressed a short time after a double click. This is avoided by:
- Do not exit selection mode in the time interval between a double click
  and a (potential) third click.
- Save the selection text on a double click, and copy the saved text,
  rather than the current selection if no third click at the end of the
  triple click interval.

M  +31   -15   src/terminalDisplay/TerminalDisplay.cpp
M  +3    -1    src/terminalDisplay/TerminalDisplay.h

https://invent.kde.org/utilities/konsole/commit/b238fb29cf9fe061df8c79b07f5126346bff9c88