Steps for one type of file overwrite
Steps to reproduce
- Create a new document called
OutlineOverwriteTest.opml - Put some text in there
- Add this line
dialog.about (http.readUrl ("http://scripting.com/states.opml"), "States outline") - Execute it
- Expand one of the nodes in the dialog outline
- Wait for Drummer to save
Drummer will have just saved states.opml into OutlineOverwriteTest.opml.
To verify,
- Close Drummer's browser window without dismissing the dialog
- Reopen Drummer
When you reopen Drummer, the tab has been renamed states.opml and the contents are the states outline.
Notes
- If you dismiss the dialog at step 7 (instead of quitting), Drummer will re-save the correct contents of
OutlineOverwriteTest.opmlover the previously-saved incorrect version. So you won't notice that the file temporarily had the wrong contents. - I think expanding the node in the dialog states outline may be what triggers the overwrite. If I let Drummer sit there without touching any of the controls, it doesn't look like it attempts to save.
I'm able to reproduce this, both on Web Drummer and Electric Drummer.
I made a quick screencast. You can see the tab text change to 'states.opml' behind the dialog when the node is expandend, and back to 'overwriteTest' right after the dialog closes. Here's the console output.
code.js:1008 saveThisTab: f == overwriteTest.md, secs == 0.264, secs since interact == 1.647
scripting.js:46 runScriptText: processedScriptText == (async function () {await processRunCursorScriptResult(await dialog.about(await http.readUrl('http://scripting.com/states.opml'), 'States outline'), 0);})()
verbs.js:1267 Using proxy server.
code.js:1543 servercall: url == http://drummer.scripting.com/httpreadurl?url=http%3A%2F%2Fscripting.com%2Fstates.opml&oauth_token=XXXX&oauth_token_secret=XXXX, secs == 0.198
code.js:4115 myExpandCallback: type == undefined
code.js:1008 saveThisTab: f == overwriteTest.md, secs == 0.239, secs since interact == 0.042
code.js:1008 saveThisTab: f == overwriteTest.md, secs == 0.234, secs since interact == 7.037
https://user-images.githubusercontent.com/8681117/148674549-2e4d5e06-4280-4b1b-88e4-fa378a101cb8.mp4
I read the report a couple of times, carefully, watched @scotthansonde video, and did the test myself twice.
i just read the report again, it seems that if you close drummer while the dialog.about dialog is open it will have overwritten the file with the states outline.
Okay I think I understand what's going wrong, but I don't know yet what the fix is. I have to spend some time thinking about it.
@PostMonsterG, @scotthansonde -- I think I have the problem fixed.
http://scripting.com/drummer/blog/2022/01/09/235613.html?title=changedHowAutosaveWorks
So please verify that it is fixed. Knock wood. ;-)
However on the way to fixing it I spotted another problem, this one only cosmetic. While the dialog is open the crumbtrail updates, and when you close the dialog, the crumb trail is still incorrect. Moving the cursor fixes it.
Unfortunately the same thing that fixed the overwriting problem will not fix the crumb trail. As before I will think about this offline.
Thank you @PostMonsterG for persevering. I like getting rid of problems like this. :-)
For me it's fixed. The underlying tab never changes when clicking in the dialog, reloading Drummer with the dialog open does not change the original outline.