Bug 468109

Summary: kwrite forgets scroll position after reopening
Product: [Applications] kate Reporter: FeepingCreature <default_357-line>
Component: kwriteAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: minor    
Priority: NOR    
Version First Reported In: 22.08.3   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description FeepingCreature 2023-04-03 07:25:14 UTC
SUMMARY
When reopening a file, kwrite remembers the cursor position but not the scrollbar position, placing the cursor at the top of the window.

STEPS TO REPRODUCE
1. Create or open a file in kwrite that has more lines than kwrite's window height
2. Place the cursor close to the top of the file, scrolled so that it is in the middle of the window.
3. Close and reopen kwrite 

OBSERVED RESULT

The cursor is now at the line you left it, but all the way at the top of the window.

EXPECTED RESULT

The scroll position should have been restored. Alternatively, the cursor should at least be in the middle of the window, so that context is visible in both directions.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 22.10
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
Comment 1 Bug Janitor Service 2023-12-12 17:12:31 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/644
Comment 2 Christoph Cullmann 2023-12-14 18:11:43 UTC
Git commit c8ed17734729b11e17447b3030a0a8214a98f512 by Christoph Cullmann, on behalf of Arthur Tadier.
Committed on 14/12/2023 at 19:11.
Pushed by cullmann into branch 'master'.

Remember scroll position in session

Unlike the cursor position, the scroll position is not saved in a
session, which means the cursor will be placed at the top of the view
instead of wherever it was last located.

Save the last scroll position in a config entry as well.

M  +11   -1    src/view/kateview.cpp

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