DroidFS icon indicating copy to clipboard operation
DroidFS copied to clipboard

Add an option to austosave text files

Open CodeCubeNeo opened this issue 1 year ago • 5 comments

Hello! I think it would be important to add that option, to save text files directly as you edit them, because if you for example click the power button of the device (meaning the volume locks), than the text file is lost. I hope my explanation was at least somewhat understandable.

CodeCubeNeo avatar Feb 25 '23 09:02 CodeCubeNeo

Can you describe a context in which this feature would be needed?

The built-in text editor is very basic and is only there to provide a quick way to read text files or make small changes. It is not intended to be a full-featured text editor. Isn't it enough to just press the "save" icon in the action bar?

hardcore-sushi avatar Feb 26 '23 20:02 hardcore-sushi

When you are editing a file and you click the power button by mistake or something, meaning the database closes and the file doesnt get saved and unsaved text is lost. Ig you can just implement that on database lock, the open file gets saved. I hope that makes sense.

CodeCubeNeo avatar Feb 26 '23 21:02 CodeCubeNeo

We could have a option to make the text get saved every minute or 30 seconds for example if I typed "Hello World" and waited 30 seconds without saving the text it would autosave like Minecraft it saves every 2 minutes I think, but at the same time it means if I write something else and didn't wait that specific time the text after that wouldn't be saved, so it's a compromise that the user would have to make.

creeper451 avatar Mar 11 '23 15:03 creeper451

Add an option to save as soon as ANY change is made

CodeCubeNeo avatar Mar 11 '23 23:03 CodeCubeNeo

I think auto-saving is a bad idea since the editor has no changes history. Imagine you want to copy the entire content of the file to the clipboard. You open the file, select everything and click on copy. But if by mistake you press a key on the keyboard, all the content is deleted and saved automatically, and you have no way to recover it.

But suppose the editor allows you to undo your changes. You could still lose the contents of the file if you delete everything by mistake and have to close the volume immediately due to an emergency situation (e.g. armed soldiers breaking down your door).

So, I won't implement this for now. I think it is much safer to let the user choose when to save the file using the "Save" icon. If you are afraid of losing your changes if the volume locks, we could imagine a feature that saves the changes and backup the old content in a new file just before the volume is closed.

hardcore-sushi avatar Mar 12 '23 11:03 hardcore-sushi