Bug 506956

Summary: Cursor position is not saved for closed tabs other than last active tab
Product: [Applications] kate Reporter: user7098473
Component: sessionsAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version First Reported In: 25.04.3   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description user7098473 2025-07-12 15:27:47 UTC
SUMMARY
Cursor position is not saved for closed tabs other than last active tab.

STEPS TO REPRODUCE
1. In a session, open two or more tabs with enough content to scroll through.
2. Scroll down to any position in two or more tabs.
3. Close and open Kate and open same session as in step 1.

OBSERVED RESULT
The last active tab (the tab that was open before Kate was closed) will have its cursor position remembered. All other tabs have their cursor position set to the top, discarding the previous cursor position.

EXPECTED RESULT
The cursor position should be where it last was before closing for all tabs and not just the last active tab. 

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 6.4.2
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.1

ADDITIONAL INFORMATION
Kate Version 25.04.3
Comment 1 Bug Janitor Service 2025-07-13 12:43:19 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1816
Comment 2 Christoph Cullmann 2025-07-13 13:44:21 UTC
Git commit f5ac709b3aab7228a269eb5bb869a21551267a26 by Christoph Cullmann, on behalf of Waqar Ahmed.
Committed on 13/07/2025 at 13:44.
Pushed by cullmann into branch 'master'.

Fix cursor position not being restored with multiple views

The session autosave that we trigger when starting up should specify
autosave=true, otherwise during session save we delete the session
config groups when saving data.

Add a test for this case, it starts up the app then opens a session
with 2 docs and then sets cursor position. We then close the app and
start up again similar to how the app is started in real world. Then
we check whether cursor position is correct

M  +75   -0    apps/lib/autotests/kate_view_mgmt_test2.cpp
M  +1    -1    apps/lib/kateapp.cpp

https://invent.kde.org/utilities/kate/-/commit/f5ac709b3aab7228a269eb5bb869a21551267a26
Comment 3 Christoph Cullmann 2025-07-13 17:21:55 UTC
Git commit 2c3091304c550e2355d0a4b3cf7749b1dbded272 by Christoph Cullmann.
Committed on 13/07/2025 at 17:21.
Pushed by cullmann into branch 'release/25.08'.

Fix cursor position not being restored with multiple views

The session autosave that we trigger when starting up should specify
autosave=true, otherwise during session save we delete the session
config groups when saving data.

Add a test for this case, it starts up the app then opens a session
with 2 docs and then sets cursor position. We then close the app and
start up again similar to how the app is started in real world. Then
we check whether cursor position is correct


(cherry picked from commit f5ac709b3aab7228a269eb5bb869a21551267a26)

Co-authored-by: Waqar Ahmed <waqar.17a@gmail.com>

M  +75   -0    apps/lib/autotests/kate_view_mgmt_test2.cpp
M  +1    -1    apps/lib/kateapp.cpp

https://invent.kde.org/utilities/kate/-/commit/2c3091304c550e2355d0a4b3cf7749b1dbded272