File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,7 @@ class AppImpl final : public App,
312
312
{
313
313
switch (event) {
314
314
case MenuBar::Event::ClickedClose:
315
+ closeDocument ();
315
316
break ;
316
317
case MenuBar::Event::ClickedDiscardChanges:
317
318
discardChanges ();
@@ -382,6 +383,17 @@ class AppImpl final : public App,
382
383
pushAppState (BrowseDocumentsState::init (this ));
383
384
}
384
385
}
386
+ // / Closes the document by clearing out the application
387
+ // / state and restarting program.
388
+ void closeDocument ()
389
+ {
390
+ // TODO : There's probably a cleaner way to do this.
391
+ stateStack.clear ();
392
+ history = History ();
393
+ zoom = 1 ;
394
+ documentID = -1 ;
395
+ AppStorage::init (this );
396
+ }
385
397
// / Saves the document to the application storage.
386
398
void saveDocumentToAppStorage ()
387
399
{
You can’t perform that action at this time.
0 commit comments