Bug 449150 - Scrolling position is not restored after reboot
Summary: Scrolling position is not restored after reboot
Status: RESOLVED FIXED
Alias: None
Product: kdeplasma-addons
Classification: Plasma
Component: notes (show other bugs)
Version: master
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: ratijas
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2022-01-25 14:41 UTC by ratijas
Modified: 2022-06-29 22:13 UTC (History)
1 user (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 ratijas 2022-01-25 14:41:24 UTC
SUMMARY

Scrolling position of long a note shouldn't be difficult to restore.

STEPS TO REPRODUCE
1. Add Notes applet.
2. Paste some long (possibly multi-line) text into it.
3. Scroll to the bottom.
4. Reboot.

OBSERVED RESULT
After reboot scrolling position is back to the top of a note.

EXPECTED RESULT
It should be restored along with other properties such as background color and the text itself.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.16.2-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2
Comment 1 ratijas 2022-01-27 19:07:32 UTC
> Scrolling position of long a note shouldn't be difficult to restore.

Oh boy, was I wrong about this part... Anyways.
Comment 2 Bug Janitor Service 2022-01-27 19:09:57 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kdeplasma-addons/-/merge_requests/108
Comment 3 ratijas 2022-06-29 22:13:59 UTC
Git commit 0852fff37d034b18d70803dc8dd294a426565888 by ivan tkachenko.
Committed on 29/06/2022 at 15:05.
Pushed by ratijas into branch 'master'.

applets/notes: Save/restore scrolling and cursor position

Makes scrolling position persistent, and takes some care to
1. delay restoring until the text is laid out,
2. throttle storage a little, so that we don't use too much I/O.

Component.onDestruction correctly saves the position on exit. It can be
tested via D-Bus by calling method quit() at:

- Session bus: org.kde.plasmashell
- Object path: /MainApplication
- Interface: org.qtproject.Qt.QCoreApplication

Cursor position restoration can be tested by assigning a global shortcut
to an applet, so that it can become focused without actually clicking
on it with a mouse and messing with cursor position. Text selection is
not handled, and I don't think we should even bother with it.

M  +13   -0    applets/notes/package/contents/config/main.xml
M  +45   -0    applets/notes/package/contents/ui/main.qml

https://invent.kde.org/plasma/kdeplasma-addons/commit/0852fff37d034b18d70803dc8dd294a426565888