Bug 474621 - Characters shift position within words; restored on selection and style change boundaries
Summary: Characters shift position within words; restored on selection and style chang...
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: master
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2023-09-17 15:54 UTC by hexchain
Modified: 2023-11-09 22:06 UTC (History)
3 users (show)

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


Attachments
Screen recording of the issue (2.35 MB, video/x-matroska)
2023-09-17 15:54 UTC, hexchain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description hexchain 2023-09-17 15:54:02 UTC
Created attachment 161673 [details]
Screen recording of the issue

SUMMARY
With the current master branch, Characters move when making a selection.

Please see the attached screen recording.

STEPS TO REPRODUCE
Select some texts in Konsole.

Versions:
Operating System: Arch Linux 
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.240.0
Qt Version: 6.6.0
Kernel Version: 6.5.3-arch1-1 (64-bit)
Graphics Platform: Wayland

Display info: 3840x2160, scale 160% (Also happens with other scale factors, such as 150% and 200%)
Comment 1 ratijas 2023-09-19 12:46:41 UTC
Technically, selection kinda "restores" position of the remaining characters (to the right) of a word being partially-selected. Seems like all text is being rendered with a negative letter spacing (instead of snapping letters to the grid); and selection boundaries force text layouting to reset to a correct X offset, but then letters proceed to drift until the end of a word.

I'm using MesloLGS NF font, and it's broken for Konsole, as well as all other monospace fonts I have installed (Liberation Mono, DejaVu Sans Mono, Hack etc). On the other hand, Fira Code works without such issues.

Also, I found in Appearance settings on the last tab Emoji font, and it was set to… simply "1pt" whatever that means. Seems like settings were not properly migrated, and what I was was a "default value" -1 that developers often use as an in-band signalling of an absence of value? Anyways, changing it to "Noto Color Emoji 11pt" did not fix the bug.
Comment 2 ratijas 2023-09-19 22:41:15 UTC
Some new data points.

Apparently, switching to a different font is not required, and actually doesn't help. But changing font size does!  …it can fix but also can make things worse.

For example, MesloLGS NF 11pt is almost perfect, but not quite; same goes for Hack font. Fira code 10pt is exactly perfect, but 12pt causes shrinking, and 11pt suddenly causes overlap! So the bug can go in other direction too.

There's something inherently wrong with how Konsole measures font metrics for the grid…
Comment 3 Christophe Marin 2023-10-09 15:30:36 UTC
(In reply to ratijas from comment #1)
> Hack etc). On the other hand, Fira Code works without such issues.

Tried locally, that's only true if the size is 10. with 9, some text is overlapping, with >10, same issue as the OP
Comment 4 hexchain 2023-11-08 15:42:00 UTC
This issue no longer reproduces for me.
Comment 5 Nate Graham 2023-11-09 22:06:31 UTC
Probably fixed for you with https://invent.kde.org/utilities/konsole/-/merge_requests/911. Unfortunately it *caused* the issue for me; see Bug 476768.