Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto/manual save within editing mode or narrow mode #126

Open
dalbandea opened this issue Dec 21, 2024 · 6 comments
Open

Auto/manual save within editing mode or narrow mode #126

dalbandea opened this issue Dec 21, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@dalbandea
Copy link

Currently autosave only seems to occur when exiting edit mode and all narrow modes, which I find a bit inconvenient: if I want to save and keep editing, I must exit edit mode, narrow mode, and then look again for the section I was editing to get into narrow mode and edit mode again. Also, many times I want to switch apps while editing within a narrow mode and there's the risk that the app gets closed and changes are lost.

I think it would be better if autosave is triggered every time one exits from edit mode. Maybe it would also be convenient to have a manual save option within edit mode?

@amake
Copy link
Owner

amake commented Dec 21, 2024

Currently autosave only seems to occur when exiting edit mode and all narrow modes

This is a consequence of the current architecture. Changes in the narrowed view aren't "applied" to the original file until you exit the narrowed view. Narrowed views are not considered "saveable" because they are completely divorced from the context of their originating file.

Also, many times I want to switch apps while editing within a narrow mode and there's the risk that the app gets closed and changes are lost

This shouldn't happen. I have taken precautions to ensure that the narrow state and editing state are preserved and restored even if the app is ejected from memory. If that's not working for you then please let me know so I can fix it. (I did just discover that after restoration you must make at least one additional edit to the content in order for it to save correctly; this will be fixed in the next version.)

Do you really need to be able to save while narrowed, or are you just concerned about data loss?

@amake
Copy link
Owner

amake commented Dec 21, 2024

The fix for applying an edit immediately after restoration will be available in v1.50.2, ready for testing soon:

@dalbandea
Copy link
Author

I'm concerned only about data loss, the manual save functionality isn't necessary for me if data integrity is ensured. If I'm in edit mode and do some edit, and I close the app from the recent apps (removing it from memory), when I open it again I see the "Recent files" view

@amake
Copy link
Owner

amake commented Dec 21, 2024

Manually removing it from memory is different from being ejected from memory by the system. State restoration only works on the latter. To test it you can enable the "Don't keep activities" system debug setting: https://developer.android.com/studio/debug/dev-options

  1. Enable "Don't keep activities"
  2. Open the editor in Orgro and change the content
  3. Switch away from Orgro
  4. Return to Orgro. The editor state should be restored. From 1.50.2 saving immediately will work; in earlier versions you need to make an additional change to the text.

@dalbandea
Copy link
Author

Yes, that should be working. The problem I see is that it's inconvenient to need to get out of editing and narrowed mode so that the save is applied, as I'm used to compulsively saving progress in emacs and vim on the laptop. Also, it can happen that when doing app switching while narrowed after editing I forget to come back to save progress and remove the app from memory manually.

@amake
Copy link
Owner

amake commented Dec 22, 2024

There are various architectural problems that make it difficult to allow persisting to disk when narrowed. My feeling is that thorough and rigorous state restoration is sufficient, so I am not inclined to look into this further at the moment.

I forget to come back to save progress and remove the app from memory manually

Manually removing apps from memory like that is not recommended (see here, here, here, etc.) so in my opinion this is borderline operator error.

@amake amake added the enhancement New feature or request label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants