From dadde2fb111371ca864c8331ff6583bdd693be1a Mon Sep 17 00:00:00 2001 From: nmurrell07 Date: Tue, 5 May 2026 14:42:48 -0500 Subject: [PATCH] fix(resizePane): Mark as handled only when resize succeeds (#20001) This fix addresses issue #19983 where resizePane actions unconditionally consume keystrokes even when no resize can occur. The fix follows the same pattern used for moveFocus and swapPane fixes: - Changed Tab::ResizePane to return bool indicating success - Changed TerminalPage::_ResizePane to return bool from ResizePane - Updated _HandleResizePane to set args.Handled() based on whether resize succeeded This allows the keychord to propagate to the terminal when no resize can occur, matching the behavior of moveFocus and swapPane (#6129). Closes #19983 --------- Co-authored-by: nmurrell07 Co-authored-by: Dustin L. Howett --- src/cascadia/TerminalApp/AppActionHandlers.cpp | 4 ++-- src/cascadia/TerminalApp/Tab.cpp | 6 +++--- src/cascadia/TerminalApp/Tab.h | 2 +- src/cascadia/TerminalApp/TerminalPage.cpp | 7 ++++--- src/cascadia/TerminalApp/TerminalPage.h | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/cascadia/TerminalApp/AppActionHandlers.cpp b/src/cascadia/TerminalApp/AppActionHandlers.cpp index bb5d859c85..7e0edef7bd 100644 --- a/src/cascadia/TerminalApp/AppActionHandlers.cpp +++ b/src/cascadia/TerminalApp/AppActionHandlers.cpp @@ -499,8 +499,8 @@ namespace winrt::TerminalApp::implementation } else { - _ResizePane(realArgs.ResizeDirection()); - args.Handled(true); + const auto resizeSucceeded = _ResizePane(realArgs.ResizeDirection()); + args.Handled(resizeSucceeded); } } } diff --git a/src/cascadia/TerminalApp/Tab.cpp b/src/cascadia/TerminalApp/Tab.cpp index ed58f8e460..da4d0896ae 100644 --- a/src/cascadia/TerminalApp/Tab.cpp +++ b/src/cascadia/TerminalApp/Tab.cpp @@ -844,14 +844,14 @@ namespace winrt::TerminalApp::implementation // Arguments: // - direction: The direction to move the separator in. // Return Value: - // - - void Tab::ResizePane(const ResizeDirection& direction) + // - whether a pane was resized + bool Tab::ResizePane(const ResizeDirection& direction) { ASSERT_UI_THREAD(); // NOTE: This _must_ be called on the root pane, so that it can propagate // throughout the entire tree. - _rootPane->ResizePane(direction); + return _rootPane->ResizePane(direction); } // Method Description: diff --git a/src/cascadia/TerminalApp/Tab.h b/src/cascadia/TerminalApp/Tab.h index 1a9d43dd7b..5f7b18c901 100644 --- a/src/cascadia/TerminalApp/Tab.h +++ b/src/cascadia/TerminalApp/Tab.h @@ -53,7 +53,7 @@ namespace winrt::TerminalApp::implementation const float splitSize, winrt::Windows::Foundation::Size availableSpace) const; - void ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction); + bool ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction); bool NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction); bool SwapPane(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction); bool FocusPane(const uint32_t id); diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 5655a9c9f1..cfffdf9a38 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -2900,14 +2900,15 @@ namespace winrt::TerminalApp::implementation // Arguments: // - direction: The direction to move the separator in. // Return Value: - // - - void TerminalPage::_ResizePane(const ResizeDirection& direction) + // - whether a pane was resized + bool TerminalPage::_ResizePane(const ResizeDirection& direction) { if (const auto tabImpl{ _GetFocusedTabImpl() }) { _UnZoomIfNeeded(); - tabImpl->ResizePane(direction); + return tabImpl->ResizePane(direction); } + return false; } // Method Description: diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index f70041f8b6..67ff3f2564 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -426,7 +426,7 @@ namespace winrt::TerminalApp::implementation const Microsoft::Terminal::Settings::Model::SplitDirection splitType, const float splitSize, std::shared_ptr newPane); - void _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction); + bool _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction); void _ToggleSplitOrientation(); void _ScrollPage(ScrollDirection scrollDirection);