Added workaround to prevent temp files hijacking active tab on session change.
And about these:
@LiquidCake Thanks for the updates! I definitely like that the temp files are preserved across project opens/closes and it seems to work very well for me.
Some more observations when playing with the feature:
* when closing a temp file and choosing "Save", I'd suggest using some other default directory than the one where temp files are stored so users aren't tempted to store the files there (and be surprised by the consequences if they choose a `gtemp_x` file name)
I would also like this but we wont be able to do it on plugin level, directory is defined and set to save-as window in core code and also very early.
Would work if we could check some specific property of document at this point, see that it is temporary and prevent using existing file path as default value for save-as window. But i guess we wont be able to do it.
* since all temp files are opened on session load, there could be one more option in the dialog asking what to do when closing a temp file - "Close". This would just close the temp file but keep it saved on the disk. I can imagine it could be useful when someone is not interested to see the temp file for some project but still wants to keep it for other projects. I'd also maybe rename "Don't save" to "Delete" so it's clear the contents of the tab is lost.
To me such UX seems to allow user too many options to chose from, and also whole idea of allowing user to "keep" temp file on disk while not having it open in editor seems contradicting the essence of feature - user should see 'temp' tab as if it was an 'untitled' tab that just doesnt disappear after we close program. If user wants to save file and close tab - they should explicitly do it with save-as.
Also, if user could just close temp tab while keeping file - it will anyway re-appear in editor after any session change.
This is also why i just copied tab-closing dialog for temp tabs from regular unsaved tab closing dialog, without any changes - it should look and feel the same (ideally).
Unfortunately, there is one case we allow user to close temp tabs without deleting/saving them - it is when 'close all' option is clicked. But this is a necessary evil, not a feature - we cannot differentiate 'close all' from changing session to/from project.
So essentially - what you are proposing can be done, but i personally would avoid it.
* it would be worth considering whether `create_new_temp_file_name()` shouldn't rather iterate over integers and test whether `gtemp_i` exists - this way, when e.g. `gtemp_5` is open and all other temp files closed, `gtemp_1-4` file names could be reused again for new tabs
done
* I'm not completely sure if `utils_is_file_writable()` should be part of Geany's API. Personally I'd rather sacrifice this check and not bloat Geany's API with another random function.
removed
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.