Bug 499669 - Cursor of multi-line edit is not aligned when there is line-ending
Summary: Cursor of multi-line edit is not aligned when there is line-ending
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: 24.12.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-08 02:22 UTC by Firestar-Reimu
Modified: 2025-02-17 05:19 UTC (History)
3 users (show)

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


Attachments
Picture 1 (748.57 KB, image/png)
2025-02-08 02:23 UTC, Firestar-Reimu
Details
Picture 2 (714.22 KB, image/png)
2025-02-08 02:24 UTC, Firestar-Reimu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Firestar-Reimu 2025-02-08 02:22:20 UTC
Cursor of multi-line edit is not aligned when there are spaces

See Picture 1, the second line is not aligned because there is a line-ending

See Picture 2, this area should be a simple rectangle, but it is ragged
Comment 1 Firestar-Reimu 2025-02-08 02:23:47 UTC
Created attachment 178059 [details]
Picture 1
Comment 2 Firestar-Reimu 2025-02-08 02:24:35 UTC
Created attachment 178060 [details]
Picture 2
Comment 3 Justin Zobel 2025-02-10 09:47:25 UTC
Can you please fill out the steps to reproduce and the system info? It helps developers understand how to reproduce the issue and what underlying software e.g. Qt and KDE Frameworks are in use.

Please change the status back to REPORTED when you reply with the requested information. Thank you.

STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version:
Comment 4 Waqar Ahmed 2025-02-10 11:59:39 UTC
can see the issue, but dont think it has anything to do with "spaces" or line endings.
Comment 5 Waqar Ahmed 2025-02-11 06:59:53 UTC
seems like if the horizontalAdvance of a font has a fractional part, then the x calculation in KateRenderer::cursorToX is slightly off when the cursor is past the end of line.

Tested with "Intel One Mono, Size:11"
Comment 6 Christoph Cullmann 2025-02-16 21:21:00 UTC
Guess we could use like Qt there qreal in a more consistent way.
Comment 7 Bug Janitor Service 2025-02-16 21:27:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/787
Comment 8 Waqar Ahmed 2025-02-17 05:19:35 UTC
Git commit fbf5a1d47ed5cb539c19427833405e164423c1b8 by Waqar Ahmed, on behalf of Christoph Cullmann.
Committed on 17/02/2025 at 05:14.
Pushed by waqar into branch 'master'.

compute at least inside cursorToX with floats

M  +5    -8    src/render/katerenderer.cpp
M  +2    -2    src/render/katerenderer.h

https://invent.kde.org/frameworks/ktexteditor/-/commit/fbf5a1d47ed5cb539c19427833405e164423c1b8