Bug 353373

Summary: "Save Session" does not actually save the session
Product: [Applications] kate Reporter: Justus Ranvier <justusranvier>
Component: sessionsAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: admin, christoph, codermotor
Priority: NOR Keywords: triaged
Version First Reported In: 21.08.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Justus Ranvier 2015-09-30 14:03:37 UTC
It appears to be impossible to add files to an existing session without deleting it first so that it can be recreated.

Reproducible: Always

Steps to Reproduce:
1. Open 10 files in the Kate application
2. "Save Session As" "foo"
3. Create 2 new files.
4. Click "Save Session"
5. Close Kate


Actual Results:  
Kate will load 10 files when loaded the second time, or via "Open Session" "foo".

Expected Results:  
Kate should load 12 files.

Saving the session should do the expected thing and add all open files to the active session.
Comment 1 Christoph Cullmann 2015-10-09 07:32:33 UTC
Could you provide your Kate version? With Kate 15.08 that seems to work well, I did you steps and it opened up with correct number of files.
Comment 2 Justus Ranvier 2015-10-27 02:48:15 UTC
This is with 3.14.12.

I can also trigger this bug in a different way.

I have a session open with 205 files in it. This session is supposed to have all the files in a particular directory in it, but it's missing some (due to the session not saving properly).

I load the missing files by opening up a Dolphin window and dragging the directory into the Documents pane (this is apparently the only way to batch open files in Kate?)

After this batch open process is complete, the Manage Sessions window still shows this session has 205 files in it even though the correct number should be 226.

Even after using the "Save Session" command in the Sessions menu, the Session Manager still shows 205 files in the session.

Now I choose "Save Session As" and pick a throwaway name for the new Session ("foo").

When I look at the Session Manager after this, session "foo" appears with 205 files, while the original session now shows 226!

If I close Kate, then open it again, the session manager now shows both the original session and foo have 226 files.
Comment 3 Andrew Crouthamel 2018-09-25 21:47:58 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Andrew Crouthamel 2018-10-27 03:43:21 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 5 Dominik Kummer 2021-09-25 10:57:29 UTC
SUMMARY
Kate does not save current session state, e.g. overwrite already saved session, as menu Sessions/Save Session suggests.

STEPS TO REPRODUCE
1. Open several files
2. Save session
3. Open session manager, remember file count.
4. Close some files
5. Save session
6. Check session manager, file count still as #3

OBSERVED RESULT
Session state not updated in Kate, but session file is overwritten. On Kate quit the old state is automatically saved which overwrittes the previously saved state with an older state.

EXPECTED RESULT
Session state including files should be overwritten on disk and in memory.

SUMMARY
Kate does not save current session state, e.g. overwrite already saved session, as menu Sessions/Save Session suggests.

STEPS TO REPRODUCE
1. Open several files
2. Save session
3. Open session manager, remember file count.
4. Close some files
5. Save session
6. Check session manager, file count still as #3

OBSERVED RESULT
Session state not updated in Kate, but session file is overwritten. On Kate quit the old state is automatically saved which overwrittes the previously saved state with an older state.

EXPECTED RESULT
Session state including files should be overwritten on disk and in memory.
Comment 6 Bug Janitor Service 2022-03-06 21:11:44 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/660
Comment 7 Christoph Cullmann 2022-03-07 20:16:15 UTC
Git commit ebff93e11ea18e27ed8a34592b91cd59be9220fc by Christoph Cullmann.
Committed on 07/03/2022 at 20:08.
Pushed by cullmann into branch 'master'.

show documents as loaded from config

M  +0    -12   kate/autotests/session_test.cpp
M  +0    -1    kate/autotests/session_test.h
M  +2    -7    kate/session/katesession.cpp
M  +1    -10   kate/session/katesession.h

https://invent.kde.org/utilities/kate/commit/ebff93e11ea18e27ed8a34592b91cd59be9220fc