[kate] [Bug 462112] Restore unsaved (newly opened - "Untilted") document doesn't work when Plasma session is restored

2023-01-23 Thread Piotr Mierzwinski
https://bugs.kde.org/show_bug.cgi?id=462112

Piotr Mierzwinski  changed:

   What|Removed |Added

 CC||piotr.mierzwin...@gmail.com

--- Comment #2 from Piotr Mierzwinski  ---
Handle of session when we have opened "untitled" file(s), which contain some
text this is one problem. Result is opened duplicate of document (which is
usual empty)  after reopen Kate (clicked "X" on window and run again Kate). In
this case content of "untitled" file is preserved.
Second thing is handle similar situation when Plasma session is restored (user
logout and login again). In this case content of "untitled" is loss and
additionally we get duplicate of "untitled" (empty).  Please notice that with
another relogin we can get another empty documents calling "untitled (n+1)"

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

[kate] [Bug 462112] Restore unsaved (newly opened - "Untilted") document doesn't work when Plasma session is restored

2023-01-15 Thread Tiernan Hubble
https://bugs.kde.org/show_bug.cgi?id=462112

Tiernan Hubble  changed:

   What|Removed |Added

 CC||thubble+kdeb...@thubble.ca

--- Comment #1 from Tiernan Hubble  ---
I'm not sure if this comment should be split off into another bug - it's
related, but a much larger scope.

This is due to the implementation of Kate's "stash unsaved documents" feature.
In Notepad++'s equivalent feature (which I personally much prefer), it operates
much like Kate's (actually KTextEditor's) "swap files". It stashes untitled
files (and created files with unsaved modifications) in the config directory on
a configurable timer (e.g. every 15 seconds). This way, even if there's a
system crash or sudden power loss, all untitled files will be preserved (except
for changes since the last timer tick, but that's several seconds by default).
I assume Notepad++ also saves these files when quitting normally.

Kate's implementation stashes untitled files in a directory sort of like
Notepad++ does, but it only does so when the app exits. So if the system
hard-crashes or there's a loss of power, the stash isn't done. The worst part
though, is that when opening stashed untitled files, Kate actually deletes them
- see KateStashManager::popDocument(). I assume the theory is that it will
re-create all of them when quitting normally the next time, and maybe this is
done to avoid complexity when reopening the session - but the result is that if
Kate (or the system) unexpectedly crashes, you lose ALL untitled files. Even
the ones that had already been stashed and re-loaded successfully on the last
Kate launch!

Kate's "swap files" functionality operates exactly like Notepad++'s, but
unfortunately it's only used for previously-created files with unsaved changes,
not untitled files. I took a look to see if I could use the existing "swap
files" functionality for unsaved files, but swap files is actually a
KTextEditor framework feature, while "stash unsaved" is implemented in Kate
itself.

Various changes have been made to handle the different ways in which Kate can
be closed (https://invent.kde.org/utilities/kate/-/merge_requests/590,
https://invent.kde.org/utilities/kate/-/merge_requests/649). It's possible that
this specific case (Plasma session save/restore) could be handled as well, but
that's yet another place that handles a specific scenario of Kate being
launched/exited. And it wouldn't fix the underlying issue that untitled files
will be lost if there's a hard-crash/power loss.

Has anyone considered changing the "stash unsaved" feature to be more like
Notepad++'s? I took a look at the code and couldn't think of an easy way to do
it. At the very least, we'd need to get rid of the behaviour that deletes files
when un-stashing them, and I'm not sure how that would interact with Kate's
existing session code. I noticed that when an unexpected crash/shutdown
happens, Kate keeps the list of open "Untitled" files, but they're all blank
due to being deleted on the previous Kate launch - so there must be some
functionality in sessions that at least preserves the list of untitled files.
Come to think of it, I'm not sure if even sessions themselves (e.g. list of
open documents) can be saved on a timer rather than on shutdown - that might be
the first step.

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

[kate] [Bug 462112] Restore unsaved (newly opened - "Untilted") document doesn't work when Plasma session is restored

2022-11-22 Thread Ganton
https://bugs.kde.org/show_bug.cgi?id=462112

Ganton  changed:

   What|Removed |Added

 CC||ku...@gmx.com

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

[kate] [Bug 462112] Restore unsaved (newly opened - "Untilted") document doesn't work when Plasma session is restored

2022-11-21 Thread Michal Kec
https://bugs.kde.org/show_bug.cgi?id=462112

Michal Kec (MiK)  changed:

   What|Removed |Added

 CC||k...@kecnet.cz

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

[kate] [Bug 462112] Restore unsaved (newly opened - "Untilted") document doesn't work when Plasma session is restored

2022-11-21 Thread bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=462112

k...@jotomo.de changed:

   What|Removed |Added

 CC||k...@jotomo.de

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

[kate] [Bug 462112] Restore unsaved (newly opened - "Untilted") document doesn't work when Plasma session is restored

2022-11-21 Thread Nate Graham
https://bugs.kde.org/show_bug.cgi?id=462112

Nate Graham  changed:

   What|Removed |Added

 CC||n...@kde.org

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