fix the focus thing, frick the env vars thing

This commit is contained in:
Mike Griese 2021-09-14 15:47:01 -05:00
parent 54a002762a
commit 723037ef99
2 changed files with 10 additions and 4 deletions

View file

@ -1490,6 +1490,7 @@ namespace winrt::TerminalApp::implementation
// - C:\windows\system32\cmd.exe -> returns true // - C:\windows\system32\cmd.exe -> returns true
// - cmd.exe -> returns false // - cmd.exe -> returns false
// - C:\windows\system32\cmd.exe /k echo sneaky sneak -> returns false // - C:\windows\system32\cmd.exe /k echo sneaky sneak -> returns false
// - %SystemRoot%\System32\cmd.exe -> TODO!
static bool _isInSystem32(std::wstring_view commandLine) static bool _isInSystem32(std::wstring_view commandLine)
{ {
// use C++11 magic statics to make sure we only do this once. // use C++11 magic statics to make sure we only do this once.
@ -1575,12 +1576,16 @@ namespace winrt::TerminalApp::implementation
{ {
if (const auto& tabImpl{ _GetTerminalTabImpl(tab) }) if (const auto& tabImpl{ _GetTerminalTabImpl(tab) })
{ {
tabImpl->GetRootPane()->WalkTree([warningControl, cmdline](std::shared_ptr<Pane> pane) -> bool { tabImpl->GetRootPane()->WalkTree([warningControl, cmdline, tabImpl](std::shared_ptr<Pane> pane) -> bool {
if (pane->GetUserControl() == *warningControl) if (pane->GetUserControl() == *warningControl)
{ {
// Hooray, we found us! // Hooray, we found us!
pane->ReplaceControl(warningControl->Control()); pane->ReplaceControl(warningControl->Control());
// Don't return true here. We want to make sure to chekc // Update the title, because replacing the control like
// this is a little weird, and doesn't actually trigger
// a TitleChanged by itself.
tabImpl->UpdateTitle();
// Don't return true here. We want to make sure to check
// all the panes for the same commandline we just // all the panes for the same commandline we just
// approved. // approved.
} }
@ -1593,6 +1598,7 @@ namespace winrt::TerminalApp::implementation
{ {
// Go ahead and allow them as well. // Go ahead and allow them as well.
pane->ReplaceControl(otherWarning->Control()); pane->ReplaceControl(otherWarning->Control());
tabImpl->UpdateTitle();
} }
} }
return false; return false;

View file

@ -35,14 +35,14 @@
// Make changes here to the powershell.exe profile. // Make changes here to the powershell.exe profile.
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell", "name": "Windows PowerShell",
"commandline": "powershell.exe", "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"hidden": false "hidden": false
}, },
{ {
// Make changes here to the cmd.exe profile. // Make changes here to the cmd.exe profile.
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "%COMMAND_PROMPT_LOCALIZED_NAME%", "name": "%COMMAND_PROMPT_LOCALIZED_NAME%",
"commandline": "cmd.exe", "commandline": "%SystemRoot%\\System32\\cmd.exe",
"hidden": false "hidden": false
} }
] ]