https://bugs.kde.org/show_bug.cgi?id=507413

            Bug ID: 507413
           Summary: Session save / restore seems to be messed up
    Classification: Applications
           Product: kate
      Version First 24.12.3
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: sessions
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: morl...@morlocknet.de
  Target Milestone: ---

SUMMARY
This happens to me on Kubuntu 25.04 (KDE Plasma 6.3.4, kate 24.12.3) as well as
on CachyOS (KDE Plasma 6.4.3, kate 25.04.3). The CachyOS was installed today
and nothing was done with it so far, so it's a completely fresh install.

I suppose the behaviors are all connected, so I'm reporting them as a single
bug. When I set up Kate to restore the last used session it seems to completely
screw up for me:
1. for all previously unsaved files, the tabs are restored, but they are empty
2. if I make changes to a file that already exists on disk and close kate
(WITHOUT saving the changes), the changes are automatically saved to the file
on exit (which is not what kate should do without asking and not what it's
settings suggest).
3. If (empty) tabs were restored due to previously unsaved files and I open an
existing file from disk, kate will close the currently open "restored" empty
tab and replace it with the opened file. This does not happen when I have an
empty tab that was just opened (not restored from session).

The funniest thing is:
In $HOME/.local/share/kate/stash/[Session name].katesession the unsaved changes
are actually stored for unsaved files. Meaning: in a scenario where I have two
unsaved files in kate and one file opened from disk, I write something in all
of them and then close kate (without saving anything), I get three files in the
aforementioned directory (Document 0, Document 1, Document 2) containing the
contents as they were when kate was closed.

In $HOME/.local/share/kate/sessions/[Session name].katesession I also see
entries for all three documents, two having no URL and one having the file-URL
of the file on disk.

So it appears that everything is stored correctly when kate exits (aside from
the fact that unsaved changes in the file on disk should of course not be saved
without asking), but they are not restored.

Another notable thing:
After kate restores the "empty" unsaved files, if i put new content in one of
the files (say "Document 0" to stick to my example scenario) and leave the
other one unchanged (i.e. empty) and then close kate, the "Document 0" is
actually updated in the stash folder while "Document 1" remains unchanged (i.e.
having the same content as it had when I first closed kate and NOT being empty
as it was when I closed kate the second time after the ill-fated restore).


STEPS TO REPRODUCE
1. Open two new Documents without saving them
2. Save the session, giving it a name (for the sake of completeness: I called
mine "Standardsitzung")
3. In kate's session settings, set up kate to use the last session on program
start and save and restore unsaved files and unsaved changes to existing files
(sorry, don't know the exact english lables for the settings)

OBSERVED RESULT
As described above

EXPECTED RESULT
kate should restore the contents of all files from the stash files and should
NOT alter existing files that were not actually saved


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 25.04 and CachyOS (Kernel 6.5.15-1-cachyos)
KDE Plasma Version: 6.3.4 and 6.4.3
KDE Frameworks Version: 6.12.0 and 6.16.0
Qt Version: 6.8.3 and 6.9.1

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to