Bug 378275 - Kate doesn't do smooth pixel-by-pixel scrolling
Summary: Kate doesn't do smooth pixel-by-pixel scrolling
Status: RESOLVED WAITINGFORINFO
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2017-03-30 13:41 UTC by Nate Graham
Modified: 2023-08-05 16:33 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2017-03-30 13:41:04 UTC
Summary:
When scrolled with a touchpad, Kate doesn't do smooth pixel-by-pixel scrolling; it goes one line at a time.


Steps to reproduce:
1. Get a laptop and install a Linux distro + KDE + Kate on it (I'm using openSUSE Tumbleweed with KDE Plasma 5.9.4 and Kate 16.12.3)
2. Create or open a long file/document in Kate
3. Use your touchpad to do a two-finger scroll to move to a new location in the document


Expected results:
The document scrolls pixel-by-pixel according to the movement of my finger, matching the way most other programs scroll (Gedit, Chromium, Firefox, Amarok).


Actual results:
The document scrolls one line at a time, producing a jumpy and jarring scroll experience--especially when encountering multi-line strings, which make the document scroll much more than expected.
Comment 1 atomnuker 2017-09-14 02:46:26 UTC
Hi,

I too would very much appreciate for both kate and konsole to do pixel-by-pixel scrolling. Kate has been the best editor I've used and whilst it has much more features than Gedit its more uncomfortable to use with large files where you need to quickly and accurately scroll between lines. There's no reason to be stuck in the 90's.
If not by default, make it an option, like with most KDE programs.

Thanks
Comment 2 Nate Graham 2017-09-14 02:58:29 UTC
I've spoken to Kate developers and they don't object. It's just a matter of doing it. I've taken a look but my C++ skills are probably not advanced enough yet. At some point, if nobody else does first, I'll return to tackle this.
Comment 3 atomnuker 2017-09-14 17:12:13 UTC
I looked into QPlainTextEdit which is what kate/konsole use and unfortunately its been written with the assumption the Y position is always going to be an integer. It would probably require a complete rewrite. Maybe a better idea is to change QPlainTextEdit for some other widged.
Comment 4 Nate Graham 2017-09-15 15:39:51 UTC
The class documentation says:

"QPlainTextEdit is a thin class, implemented by using most of the technology that is behind QTextEdit and QTextDocument. Its performance benefits over QTextEdit stem mostly from using a different and simplified text layout called QPlainTextDocumentLayout on the text document (see QTextDocument::setDocumentLayout()). The plain text document layout does not support tables nor embedded frames, and replaces a pixel-exact height calculation with a line-by-line respectively paragraph-by-paragraph scrolling approach."

http://doc.qt.io/qt-5.9/qplaintextedit.html

This suggests two options:

1. Suggest to the Qt folks that they re-architect QPlainTextEdit to support optional pixel-by-pixel scrolling while retaining as many of the performance benefits of the status quo as possible. This seems unlikely, but I have submitted an upstream bug report anyway: https://bugreports.qt.io/browse/QTBUG-63241

2. Change Kate and Konsole to use the QTextEdit class (which supports smooth pixel-by-pixel scrolling) and live with whatever performance penalty this imposes. We would definitely need to test with huge documents and lousy hardware to see at what point the performance penalty becomes noticeable, and decide if we can live with that. This seems like what we should focus on in the short to medium term, and make sure we test thoroughly to make sure the performance hit is either negligible or acceptable.

Another consideration: if we wait for the Qt bug to be resolved (if it ever is), then we will have to wait before we can turn pixel scrolling until the version of QT that supports it is released and widely available, which may be quite a long time (if ever).
Comment 5 Christoph Feck 2017-09-28 01:48:52 UTC
Neither Kate nor Konsole uses QPlainTextEdit or QTextEdit. Both use a custom widget, tailored to the specific use case.
Comment 6 Christoph Feck 2017-10-04 14:29:10 UTC
To clarify: They cannot use Qt classes, because of multiple limitations. Reverting description accordingly.
Comment 7 Michael D 2018-03-22 15:45:37 UTC
Related to this ancient bug I filed roughly 8 years ago!
https://bugs.kde.org/show_bug.cgi?id=256561
Comment 8 Nate Graham 2018-03-22 15:49:12 UTC
Yep, duplicate of Bug 256561.

Really hoping to get this fixed...

*** This bug has been marked as a duplicate of bug 256561 ***
Comment 9 Nate Graham 2018-08-12 22:08:03 UTC
Unmarking as a duplicate of Bug 256561 because there's a patch that fixes that, but not this. This will have to be fixed separately.
Comment 10 Christoph Cullmann 2023-08-05 16:33:43 UTC
This is a nice wish, but so far nobody did step up to implement it for 5 years and longer.

If somebody wants to have this happen, please step up to provide a patch: https://kate-editor.org/post/2020/2020-07-18-contributing-via-gitlab-merge-requests/