I have been thinking about making that a feature request. The only problem is that many things that would wipe out the “Source Text” backup would also wipe out the “QuickLook Preview” resource as well. But as I am finding out there are times where the “Source Text” does get wiped out while the “QuickLook Preview” does not. To me I would want to try every possible way to recover a script. But I can’t say just how many times the original and “Source Text” would be wiped out but the “QuickLook Preview” would survive. So I keep thinking maybe I should ask that for a feature request.
What it comes down to is there are multiple alternatives. Is it better is to hang onto the old source code that was being used before a save as well as the the source text that was actually saved. This helps when a script dies on me and later I go to get it from the script file but it turns out the problem existed before I saved and what was saved was also messed up. Then the “Recover Damaged Script” has a backup and another backup before that.
So this method would be something like move “Source Text” into “Source Text backup,” put the text about to be saved into “Source Text” and then save the information to the disk. Both “Source Text” and “Source Text backup” would be saved in a resource in the script file.
Of course Script Debugger could have a problem that would make all future saves go wrong until it is restarted and this would not work. It has been my experience that in nearly all cases either the file is empty or correct. But you could have yet another backup but it would have to end somewhere. Also Script Debugger could read what it just wrote to disk and compare it to what is in the editor right after that save. So there are a lot of alternatives with some that return moderate gain but would be easy to do, while others return better results but would be harder to do.
Another that could be done is to check the size of what was saved and if it is a zero byte script then issue a warning and to users and they can act accordingly. I would expect it would be a pretty small number of users, if any at all, that would save a blank file on purpose.
So if I asked for a feature request I’m not sure what to ask for. But for right now the method I described does work if the “Quick Look” is still intacted and someone wants to do the manual work themselves. Apparently I’m not very good at being decisive on this issue .