TobyLobster / Inform

Inform is a design system for interactive fiction based on natural language
Other
82 stars 18 forks source link

Reset change count when project window is opened #34

Closed angstsmurf closed 1 year ago

angstsmurf commented 1 year ago

When a document is opened, its change count is immediately incremented, which is obviously incorrect, because it just opened and has no changes. This is annoying, because trying to close the project or quitting Inform right after it has opened will throw up an "Are you sure?" dialog.

What happens is that the delegate method [IFSkeinPage didResizeSplitView] is called when the window is opened, which calls [IFSkeinPage setTestingTabHelpShownSetting:], which calls [IFCompilerSettings setTestingTabHelpShown:], which calls [IFCompilerSettings settingsHaveChanged], which issues a IFSettingNotification that [IFProjectController updateSettings]responds to, marking the document as edited.

I'm not sure which of these if any should be considered a bug and should be changed, or how, but fortunately we can just set the document as unedited instead in the windowDidBecomeMain method, the first time it is called after loading.

See bug I7-1845.

TobyLobster commented 1 year ago

I instead fixed the two places where the settings were being flagged as having changed when they shouldn't have.

angstsmurf commented 1 year ago

Not sure if you'll see this, but there is still a settingsHaveChanged call in IFCompilerSettings.m which marks the document as edited when opening the Testing tab.

TobyLobster commented 1 year ago

Thanks, I'll remove that soon.

TobyLobster commented 1 year ago

Actually this is a weird one. The first 10 times you go to the testing tab for a new project, it shows a welcome message introducing the testing tab. So the project has to keep track of the number of times it is shown:

Screenshot 2023-04-18 at 21 13 13
angstsmurf commented 1 year ago

Fair enough.

I suppose the long-term sensible solution is to implement autosaving, as per Andrew Plotkin's suggestion in the Jira issue.