Danger situation from losing code if Ctrl+S isn't pressed before exit.
There is no way to avoid the console closing after user clicked the X icon or press Alt+F4. What I suggesting is always auto saving the changes to a temporary file. If the user unexpected close the console the changes already are in that temporary file. If the user saves the designer before exit that temporary file is deleted. When the user reopen the designer later if still exist the temporary file, the tool will ask to the user if he wants to save the unsaved changes and thus this tool will be more reliability for the user.
Good idea. Also related to this is https://github.com/gui-cs/TerminalGuiDesigner/issues/36
I think first step is to track unsaved changes and warn when closing with Ctrl+Q. Then this is a logical next step to offer recovery like you say.
There is now a warning when trying to exit with ctrl+Q so this is less important but still a nice feature to have
That good, thanks. Now if the user close the console without pressing Ctrl+Q, on the next running, before the user do some action, the app will check if there is a temp code file that wasn't saved before and asks if he want to saved first. What I suggest is having a event handler that will always be invoked after the user do changes to the current project and thus the tool saves in the background to a temp file. This way if the user close the console without saving, this temp file will be used as I explained above.
Yup, sorry. That comment was just for anyone comming across this issue later to say that its planned but not urgent.