Bug 394833

Summary: Katepart swap file feature not available for unsaved or moved files
Product: [Applications] kate Reporter: Shriramana Sharma <samjnaa>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: christoph, codestruct, justin.zobel, kde.lwzr1, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Shriramana Sharma 2018-05-29 16:10:42 UTC
Steps to reproduce:
Test A:
1. Open Kate/KWrite.
2. Type something.
3. Save to a file on disk.
4. Type some more.
5. Kill the process without closing the app correctly.
6. Reopen the file in Kate/KWrite.
7. It flags the file as "not closed properly" and offers to recover the unsaved data.

Test B:
1. Close the above file without recovering the data.
2. Move the file on disk (without the unsaved data) to another location.
3. Open it from there in Kate/KWrite.
4. It does NOT flag the file as "not closed properly" and does not offer to recover the unsaved data.

Test C:
1. Open a new document in Kate/KWrite.
2. Type something.
3. Kill the process as before but *without* saving to disk.
4. Reopen Kate/KWrite.
5. It does NOT advise you that a document was not saved and does not offer to recover the unsaved data.

Observed behaviour:
Test A is the nominal behaviour. In Test B and Test C, there is no way to recover the lost data. Other applications such as LibreOffice which are used for other purposes and not really useful for plaintext editing such as Kate/KWrite however have a data recovery feature which only depends on the existence of the swap file and not on the existence of the saved file or of such a file being located in the same directory.

Expected behaviour:
1. Loss of data is unacceptable.
2. Katepart should save swap data for unsaved files also.
3. When Kate/KWrite (or at least Kate only) is reopened after an abnormal termination, it should advise the user of the availability of such swap data, whether for saved or unsaved documents, and offer to recover the data.

Comment:
1. This behaviour is already found in LibreOffice etc but which aren't useful for the usecase of Kate/KWrite etc. Hence I request for Kate to have this ability.
2. I lost many paragraphs of writing this morning because of this limitation, prompting me to file this bug.

Thanks!
Comment 1 Shriramana Sharma 2018-05-29 16:14:00 UTC
Under "expected behaviour" I forgot to add a fourth point:

4. Same swap behaviour should be available for moved files also. Of course, Katepart can't know where the file has been moved *to*, but it should know where the file was earlier and should offer to save there or at least it should offer to save it somewhere if that location no longer exists.
Comment 2 Christoph Feck 2018-06-15 11:33:25 UTC
Was your loss of data caused by a crash, or did you kill Kate manually?
Comment 3 Shriramana Sharma 2018-06-18 03:47:39 UTC
(In reply to Christoph Feck from comment #2)
> Was your loss of data caused by a crash, or did you kill Kate manually?

Initially it was caused by a system power loss due to my UPS battery failing, but for testing of course I didn't pull the plug! Surely the effect is the same whether it goes down itself or we kill it?
Comment 4 Gregor Mi 2018-07-14 20:36:26 UTC
I recently saw how Notepad++ is dealing with unsaved files:

1. Open Notepad++, create a new tab and type something
2. Close Notepad++; there is no "do you want to save" question
3. Open it again; the content of unsaved tab was restored without any message

I am not convinced whether this message-less behaviour is a good. But just for the record.
Comment 5 Thibault Molleman 2020-06-11 07:36:57 UTC
I'm also coming from windows and using notepad++. Their behaviour is brilliant.
If all my windows 'resume' after a reboot on linux. I expect a text editor to also just 'resume' in the exact same state. With all files including unsaved text to be open
Comment 6 Christoph Cullmann 2020-06-11 14:38:20 UTC
I am very open to have such a feature ;=)
Unfortunately I think at the moment nobody is working on this.
Patches highly welcome!
Comment 7 Justin Zobel 2020-10-30 03:52:17 UTC

*** This bug has been marked as a duplicate of bug 353654 ***