diff --git a/src/cascadia/TerminalApp/Pane.cpp b/src/cascadia/TerminalApp/Pane.cpp index 82693d0dc03..d3d9a37504e 100644 --- a/src/cascadia/TerminalApp/Pane.cpp +++ b/src/cascadia/TerminalApp/Pane.cpp @@ -44,6 +44,7 @@ Pane::Pane(const Profile& profile, const TermControl& control, const bool lastFo _connectionStateChangedToken = _control.ConnectionStateChanged({ this, &Pane::_ControlConnectionStateChangedHandler }); _warningBellToken = _control.WarningBell({ this, &Pane::_ControlWarningBellHandler }); + _triggerHitToken = _control.TriggerHit({ this, &Pane::_ControlTriggerHitHandler }); // On the first Pane's creation, lookup resources we'll use to theme the // Pane, including the brushed to use for the focused/unfocused border @@ -1138,6 +1139,21 @@ void Pane::_ControlWarningBellHandler(const winrt::Windows::Foundation::IInspect } } +void Pane::_ControlTriggerHitHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/, + const winrt::Microsoft::Terminal::Control::TriggerHitArgs& eventArgs) +{ + if (!_IsLeaf()) + { + return; + } + if (_profile) + { + auto triggers = _profile.Triggers(); + auto trigger = triggers.GetAt(eventArgs.Index()); + auto action = trigger.EvaluateMatch(eventArgs.Matches(), nullptr); + } +} + // Event Description: // - Called when our control gains focus. We'll use this to trigger our GotFocus // callback. The tab that's hosting us should have registered a callback which @@ -1586,6 +1602,7 @@ void Pane::_CloseChild(const bool closeFirst, const bool isDetaching) // Add our new event handler before revoking the old one. _connectionStateChangedToken = _control.ConnectionStateChanged({ this, &Pane::_ControlConnectionStateChangedHandler }); _warningBellToken = _control.WarningBell({ this, &Pane::_ControlWarningBellHandler }); + _triggerHitToken = _control.TriggerHit({ this, &Pane::_ControlTriggerHitHandler }); // Revoke the old event handlers. Remove both the handlers for the panes // themselves closing, and remove their handlers for their controls @@ -1601,6 +1618,7 @@ void Pane::_CloseChild(const bool closeFirst, const bool isDetaching) { p->_control.ConnectionStateChanged(p->_connectionStateChangedToken); p->_control.WarningBell(p->_warningBellToken); + p->_control.TriggerHit(p->_triggerHitToken); } }); } @@ -1609,6 +1627,7 @@ void Pane::_CloseChild(const bool closeFirst, const bool isDetaching) remainingChild->Closed(remainingChildClosedToken); remainingChild->_control.ConnectionStateChanged(remainingChild->_connectionStateChangedToken); remainingChild->_control.WarningBell(remainingChild->_warningBellToken); + remainingChild->_control.TriggerHit(remainingChild->_triggerHitToken); // If we or either of our children was focused, we want to take that // focus from them. @@ -1690,6 +1709,7 @@ void Pane::_CloseChild(const bool closeFirst, const bool isDetaching) { p->_control.ConnectionStateChanged(p->_connectionStateChangedToken); p->_control.WarningBell(p->_warningBellToken); + p->_control.TriggerHit(p->_triggerHitToken); } }); } @@ -2445,6 +2465,8 @@ std::pair, std::shared_ptr> Pane::_Split(SplitDirect _connectionStateChangedToken.value = 0; _control.WarningBell(_warningBellToken); _warningBellToken.value = 0; + _control.TriggerHit(_triggerHitToken); + _triggerHitToken.value = 0; // Remove our old GotFocus handler from the control. We don't want the // control telling us that it's now focused, we want it telling its new diff --git a/src/cascadia/TerminalApp/Pane.h b/src/cascadia/TerminalApp/Pane.h index 02336a94ccb..a312d4e29e1 100644 --- a/src/cascadia/TerminalApp/Pane.h +++ b/src/cascadia/TerminalApp/Pane.h @@ -203,6 +203,7 @@ class Pane : public std::enable_shared_from_this WINRT_CALLBACK(LostFocus, winrt::delegate>); WINRT_CALLBACK(PaneRaiseBell, winrt::Windows::Foundation::EventHandler); WINRT_CALLBACK(Detached, winrt::delegate>); + WINRT_CALLBACK(TriggerAction, winrt::delegate>); private: struct PanePoint; @@ -236,6 +237,7 @@ class Pane : public std::enable_shared_from_this winrt::event_token _firstClosedToken{ 0 }; winrt::event_token _secondClosedToken{ 0 }; winrt::event_token _warningBellToken{ 0 }; + winrt::event_token _triggerHitToken{ 0 }; winrt::Windows::UI::Xaml::UIElement::GotFocus_revoker _gotFocusRevoker; winrt::Windows::UI::Xaml::UIElement::LostFocus_revoker _lostFocusRevoker; @@ -289,6 +291,8 @@ class Pane : public std::enable_shared_from_this const winrt::Windows::UI::Xaml::RoutedEventArgs& e); void _ControlLostFocusHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e); + void _ControlTriggerHitHandler(const winrt::Windows::Foundation::IInspectable& sender, + const winrt::Microsoft::Terminal::Control::TriggerHitArgs& e); std::pair _CalcChildrenSizes(const float fullSize) const; SnapChildrenSizeResult _CalcSnappedChildrenSizes(const bool widthOrHeight, const float fullSize) const;