Bug 408048 - Selection by words is sticky in Midnight Commander
Summary: Selection by words is sticky in Midnight Commander
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 18.12.3
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-28 22:38 UTC by Lastique
Modified: 2022-05-23 10:58 UTC (History)
2 users (show)

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 Lastique 2019-05-28 22:38:00 UTC
SUMMARY
Somewhere between Konsole 18.04.3 in Kubuntu 18.10 and 18.12.3 in Kubuntu 19.04, selecting text with mouse in Midnight Commander running in Konsole or Yakuake became sticky. This is super annoying.

STEPS TO REPRODUCE
1. Start Konsole, run "mc".
2. In Midnight Commander, open a text file and start typing.
3. Select a piece of text by pressing Shift, Left mouse button and moving the mouse. Notice that selection is adjusted by character, you can start and end selection in the middle of a word.
4. Select a word in the text by pressing Shift and double-clicking Left mouse button on the word. The whole word is selected.
5. Try again to select a piece of text, like in step 3.

OBSERVED RESULT
In step 5, moving the mouse selects text by words, not by characters. You can try starting the selection multiple times, every time it will select text by words. It is not possible to restore the original behavior of selection by characters, except by Left clicking somewhere in the text.

EXPECTED RESULT
1. Shift + Left click should always start selection by character.
2. Shift + Double left click should always start selection by words.

The two rules should be true no matter what kind of selection had been done before.

SOFTWARE/OS VERSIONS
Linux: Kubuntu 19.04
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2
Comment 1 Christoph Feck 2019-06-14 11:09:33 UTC
Is this issue only visible in "mc" or also in other terminal applications, such as text editors?
Comment 2 Lastique 2019-06-14 15:42:46 UTC
Technically, this is reproducible in both mc and mcedit (i.e. the file manager itself and the editor).

I can't reproduce it in bare console or nano. I suspect this might be related to the fact that those don't handle mouse events and I don't have to hold Shift while selecting text. I can reproduce it with htop, which does handle mouse events.
Comment 3 Dan Stahlke 2019-10-25 02:49:30 UTC
Also happens in tmux.  Konsole 18.12.3.
Comment 4 Bug Janitor Service 2022-05-19 10:34:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/655
Comment 5 tcanabrava 2022-05-23 10:58:44 UTC
Git commit e4cbfef2b5a18337b6ae787db2cc253df721e7e6 by Tomaz  Canabrava, on behalf of Luis Javier Merino Morán.
Committed on 23/05/2022 at 10:50.
Pushed by tcanabrava into branch 'master'.

Allow ending wordwise select in mousetracking mode

Commit e2167eb0 restricted deactivating the word-wise/line-wise
selection mode to mouse presses with no modifiers.  Since in
mouse-tracking mode, the Shift key has to be pressed to not pass mouse
events to the application running on the terminal, there was no way to
end word-wise/line-wise selection mode without sending a mouse event to
the application.

Modify the logic so ending word-wise/line-wise selection mode is done by
a LMB button press with no modifiers on non-mousetracking mode, and by a
LMB button press with only the Shift modifier on mousetracking mode.

M  +1    -1    src/terminalDisplay/TerminalDisplay.cpp

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