Bug 474055

Summary: Partial selection of double width characters
Product: [Applications] konsole Reporter: Grigory <txgk>
Component: fontAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: minor CC: ninjalj
Priority: NOR    
Version: 23.08.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: v23.08.3
Sentry Crash Report:
Attachments: Video demonstration

Description Grigory 2023-09-02 13:22:52 UTC
Created attachment 161342 [details]
Video demonstration

SUMMARY

When selecting double width characters, there's a possibility to select "nothing" which may contain invisible control characters. Reproduced it in both 23.04.2 and 23.08.0 versions of Konsole.

STEPS TO REPRODUCE
1. Run Konsole
2. Insert some double width characters
3. Try to select them starting from about the middle of the character

OBSERVED RESULT

Double character is selected partially (see attached video)

EXPECTED RESULT

Double character must be selected completely

SOFTWARE/OS VERSIONS

Konsole: 23.04.2 (from repos), 23.08.0 (from flathub)
Window compositor: Sway 1.8.1
OS: Void Linux (up-to-date)

ADDITIONAL INFORMATION

See attached video for demonstration
Comment 1 Bug Janitor Service 2023-09-23 00:52:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/konsole/-/merge_requests/897
Comment 2 Kurt Hindenburg 2023-10-04 13:50:15 UTC
Git commit 8fc924849a592c410f2fb519fe6ccbaedb55517b by Kurt Hindenburg, on behalf of Luis Javier Merino MorĂ¡n.
Committed on 04/10/2023 at 15:45.
Pushed by hindenburg into branch 'master'.

Don't select half a CJK character

This was a visual regression.  Code using the selection already takes
care of dealing with CJK wide characters (mostly), and the old rendering
in TerminalPainter also did.  The new rendering is split in several
layers, which need to know about the selection to use the proper
background and foreground colors, but don't necessarily need to know
about characters, and this caused the regression.

To prevent trouble, we now take care of CJK wide characters before
rendering, when obtaining the characters from the model (Screen), where
characters are marked as selected if they fall into the selection
coordinates.

M  +21   -4    src/Screen.cpp
M  +0    -6    src/terminalDisplay/TerminalPainter.cpp

https://invent.kde.org/utilities/konsole/-/commit/8fc924849a592c410f2fb519fe6ccbaedb55517b