diff --git a/src/cascadia/TerminalApp/TabManagement.cpp b/src/cascadia/TerminalApp/TabManagement.cpp index 4219083a3e4..b7644df9836 100644 --- a/src/cascadia/TerminalApp/TabManagement.cpp +++ b/src/cascadia/TerminalApp/TabManagement.cpp @@ -248,8 +248,9 @@ namespace winrt::TerminalApp::implementation // - profile: profile settings for this connection // - settings: the TerminalSettings object to use to create the TerminalControl with. // - existingConnection: optionally receives a connection from the outside world instead of attempting to create one - winrt::fire_and_forget TerminalPage::_CreateNewTabWithProfileAndSettings(Microsoft::Terminal::Settings::Model::Profile profile, Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult settings, TerminalConnection::ITerminalConnection existingConnection) + void TerminalPage::_CreateNewTabWithProfileAndSettings(Microsoft::Terminal::Settings::Model::Profile profile, Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult settings, TerminalConnection::ITerminalConnection existingConnection) { + bool doAdminWarning = false; if (_isElevated()) { auto cmdline{ settings.DefaultSettings().Commandline() }; @@ -271,19 +272,20 @@ namespace winrt::TerminalApp::implementation { allowedCommandlines = winrt::single_threaded_vector(); } - if (!commandlineWasAllowed) - { - ContentDialogResult warningResult = co_await _ShowCommandlineApproveWarning(); - if (warningResult != ContentDialogResult::Primary) - { - co_return; - } - else - { - allowedCommandlines.Append(cmdline); - } - ElevatedState::SharedInstance().AllowedCommandlines(allowedCommandlines); - } + doAdminWarning = !commandlineWasAllowed; + // if (!commandlineWasAllowed) + // { + // ContentDialogResult warningResult = co_await _ShowCommandlineApproveWarning(); + // if (warningResult != ContentDialogResult::Primary) + // { + // co_return; + // } + // else + // { + // allowedCommandlines.Append(cmdline); + // } + // ElevatedState::SharedInstance().AllowedCommandlines(allowedCommandlines); + // } } // Initialize the new tab diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index d684fbce4df..71a47cd817b 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -191,7 +191,7 @@ namespace winrt::TerminalApp::implementation void _OpenNewTabDropdown(); HRESULT _OpenNewTab(const Microsoft::Terminal::Settings::Model::NewTerminalArgs& newTerminalArgs, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection existingConnection = nullptr); void _CreateNewTabFromPane(std::shared_ptr pane); - winrt::fire_and_forget _CreateNewTabWithProfileAndSettings(Microsoft::Terminal::Settings::Model::Profile profile, Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult settings, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection existingConnection = nullptr); + void _CreateNewTabWithProfileAndSettings(Microsoft::Terminal::Settings::Model::Profile profile, Microsoft::Terminal::Settings::Model::TerminalSettingsCreateResult settings, winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection existingConnection = nullptr); winrt::Microsoft::Terminal::TerminalConnection::ITerminalConnection _CreateConnectionFromSettings(Microsoft::Terminal::Settings::Model::Profile profile, Microsoft::Terminal::Settings::Model::TerminalSettings settings); winrt::fire_and_forget _OpenNewWindow(const bool elevate, const Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs); diff --git a/src/cascadia/TerminalApp/TerminalTab.cpp b/src/cascadia/TerminalApp/TerminalTab.cpp index a3a2a1651b8..3021d63651a 100644 --- a/src/cascadia/TerminalApp/TerminalTab.cpp +++ b/src/cascadia/TerminalApp/TerminalTab.cpp @@ -25,7 +25,7 @@ namespace winrt namespace winrt::TerminalApp::implementation { - TerminalTab::TerminalTab(const Profile& profile, const TermControl& control) + TerminalTab::TerminalTab(const Profile& profile, const WUX::Controls::UserControl& control) { _rootPane = std::make_shared(profile, control, true); @@ -449,7 +449,7 @@ namespace winrt::TerminalApp::implementation void TerminalTab::SplitPane(SplitState splitType, const float splitSize, const Profile& profile, - TermControl& control) + const WUX::Controls::UserControl& control) { // Make sure to take the ID before calling Split() - Split() will clear out the active pane's ID const auto activePaneId = _activePane->Id(); @@ -471,7 +471,8 @@ namespace winrt::TerminalApp::implementation // Add a event handlers to the new panes' GotFocus event. When the pane // gains focus, we'll mark it as the new active pane. - _AttachEventHandlersToControl(second->Id().value(), control); + const auto& termControl{ control.try_as() }; + _AttachEventHandlersToControl(second->Id().value(), termControl); _AttachEventHandlersToPane(first); _AttachEventHandlersToPane(second); @@ -804,6 +805,10 @@ namespace winrt::TerminalApp::implementation // - void TerminalTab::_AttachEventHandlersToControl(const uint32_t paneId, const TermControl& control) { + if (!control) + { + return; + } auto weakThis{ get_weak() }; auto dispatcher = TabViewItem().Dispatcher(); ControlEventTokens events{}; diff --git a/src/cascadia/TerminalApp/TerminalTab.h b/src/cascadia/TerminalApp/TerminalTab.h index b1824d98eaa..5395b02f5f4 100644 --- a/src/cascadia/TerminalApp/TerminalTab.h +++ b/src/cascadia/TerminalApp/TerminalTab.h @@ -21,7 +21,8 @@ namespace winrt::TerminalApp::implementation struct TerminalTab : TerminalTabT { public: - TerminalTab(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile, const winrt::Microsoft::Terminal::Control::TermControl& control); + TerminalTab(const winrt::Microsoft::Terminal::Settings::Model::Profile& profile, + const winrt::Windows::UI::Xaml::Controls::UserControl& control); TerminalTab(std::shared_ptr rootPane); // Called after construction to perform the necessary setup, which relies on weak_ptr @@ -41,7 +42,7 @@ namespace winrt::TerminalApp::implementation void SplitPane(winrt::Microsoft::Terminal::Settings::Model::SplitState splitType, const float splitSize, const winrt::Microsoft::Terminal::Settings::Model::Profile& profile, - winrt::Microsoft::Terminal::Control::TermControl& control); + const winrt::Windows::UI::Xaml::Controls::UserControl& control); void ToggleSplitOrientation(); winrt::fire_and_forget UpdateIcon(const winrt::hstring iconPath);