Repository: microsoft/terminal (language: cpp)

Issue:
Automatically dismiss "Failed to reload settings" modals when settings.json is valid
<!-- 
🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨

I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING:
1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement.
2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement.
3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number).
4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement.
5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement.

All good? Then proceed!
-->

# Current behavior 

This happens to me pretty much every time I edit my `settings.json` file:

1. I start making a minor edit
2. My editor's auto-save feature automatically saves (for any number of reasons)... or I accidently hit ctrl-s just out of habit
3. For this brief moment, my `settings.json` file is invalid
4. So all my currently running Terminal windows display the [`Failed to reload settings`](https://user-images.githubusercontent.com/10755858/71671836-147a6300-2d9a-11ea-9910-8aeb0845e952.png) modal immediately
5. A few seconds later I've already completed my minor edit, and saved the valid `settings.json` file
6. But I now have to click through like 20 windows, and manually click on all the `OK` buttons to dismiss all the modals, even though my `settings.json` file is already back in a valid state

# Suggested behavior

At point 5 above, assuming `settings.json` is now valid again: automatically dismiss all these modals, as they're no longer relevant, and can be disruptive when you've got lots of windows open.




Discussion / hints:
this is a great idea why have we never done this
Oh jeez, how DID we miss that?
Hi @DHowett , @zadjii-msft , this is an interesting one; just a few observations to check my understanding:
--> `TerminalWindow::UpdateSettings` is used to validate the settings and display error or warning dialogs.
--> There are two condition checks for `args.Result()` based on which we fire the dialogs, so can I add a third one to check if `args.Result() == S_OK ` and if true, dismiss the dialog via `DismissDialog()`?
--> Any other way to close the dialog, from what I see `DismissDialog()` is the only way..

Any comments/suggestions?
@codecruisedor Sorry I missed this! Yep, I'd concur that `TerminalWindow::DismissDialog` seems like the right thing to call here. Seems like you've got the right fix in mind ☺️ 

Fix patch:
diff --git a/src/cascadia/TerminalApp/TerminalWindow.cpp b/src/cascadia/TerminalApp/TerminalWindow.cpp
index 8be6872e98b..66db1eb70b3 100644
--- a/src/cascadia/TerminalApp/TerminalWindow.cpp
+++ b/src/cascadia/TerminalApp/TerminalWindow.cpp
@@ -783,6 +783,10 @@ namespace winrt::TerminalApp::implementation
             {
                 _ShowLoadWarningsDialog(args.Warnings());
             }
+            else if (args.Result() == S_OK)
+            {
+                DismissDialog();
+            }
             _RefreshThemeRoutine();
         }
     }


Test patch: