From ae8a3dceaf96b8e4eeeb69fb4facbd7a6c19d107 Mon Sep 17 00:00:00 2001 From: nmurrell07 Date: Fri, 20 Mar 2026 16:12:57 -0500 Subject: [PATCH 1/4] fix(resizePane): Mark as handled only when resize succeeds 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 (GH#6129). --- src/cascadia/TerminalApp/AppActionHandlers.cpp | 4 ++-- src/cascadia/TerminalApp/Tab.cpp | 6 +++--- src/cascadia/TerminalApp/Tab.h | 2 +- src/cascadia/TerminalApp/TerminalPage.cpp | 6 +++--- src/cascadia/TerminalApp/TerminalPage.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cascadia/TerminalApp/AppActionHandlers.cpp b/src/cascadia/TerminalApp/AppActionHandlers.cpp index 48ed69822a2..fd96c61c3e2 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 4bbf58e50ad..0c018a65d9a 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) + // - true if a resize was performed, false otherwise + 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 65d4e574ede..d7525746906 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 e98de6b9957..ba189155e35 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -2791,13 +2791,13 @@ namespace winrt::TerminalApp::implementation // Arguments: // - direction: The direction to move the separator in. // Return Value: - // - - void TerminalPage::_ResizePane(const ResizeDirection& direction) + // - true if a resize was performed, false otherwise + bool TerminalPage::_ResizePane(const ResizeDirection& direction) { if (const auto tabImpl{ _GetFocusedTabImpl() }) { _UnZoomIfNeeded(); - tabImpl->ResizePane(direction); + return tabImpl->ResizePane(direction); } } diff --git a/src/cascadia/TerminalApp/TerminalPage.h b/src/cascadia/TerminalApp/TerminalPage.h index 4b48cc0e9d9..7c9c2bad27a 100644 --- a/src/cascadia/TerminalApp/TerminalPage.h +++ b/src/cascadia/TerminalApp/TerminalPage.h @@ -412,7 +412,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); From 3a50d121c46f1f485778204a1d251609b54a2ae3 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Tue, 5 May 2026 14:05:55 -0500 Subject: [PATCH 2/4] Fix the PR. --- src/cascadia/TerminalApp/TerminalPage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index cf92e14bd51..02b46f67535 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -2908,6 +2908,7 @@ namespace winrt::TerminalApp::implementation _UnZoomIfNeeded(); return tabImpl->ResizePane(direction); } + return false; } // Method Description: From 0da767e6925f32f10249bf8ccb796d3c419369e6 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Tue, 5 May 2026 14:07:24 -0500 Subject: [PATCH 3/4] fix the code format... --- src/cascadia/TerminalApp/AppActionHandlers.cpp | 4 ++-- src/cascadia/TerminalApp/Tab.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cascadia/TerminalApp/AppActionHandlers.cpp b/src/cascadia/TerminalApp/AppActionHandlers.cpp index 8ef132999c0..7e0edef7bd5 100644 --- a/src/cascadia/TerminalApp/AppActionHandlers.cpp +++ b/src/cascadia/TerminalApp/AppActionHandlers.cpp @@ -499,8 +499,8 @@ namespace winrt::TerminalApp::implementation } else { - const auto resizeSucceeded = _ResizePane(realArgs.ResizeDirection()); - args.Handled(resizeSucceeded); + const auto resizeSucceeded = _ResizePane(realArgs.ResizeDirection()); + args.Handled(resizeSucceeded); } } } diff --git a/src/cascadia/TerminalApp/Tab.cpp b/src/cascadia/TerminalApp/Tab.cpp index c43ca8b994c..66f348f3253 100644 --- a/src/cascadia/TerminalApp/Tab.cpp +++ b/src/cascadia/TerminalApp/Tab.cpp @@ -844,7 +844,7 @@ namespace winrt::TerminalApp::implementation // Arguments: // - direction: The direction to move the separator in. // Return Value: - // - true if a resize was performed, false otherwise + // - true if a resize was performed, false otherwise bool Tab::ResizePane(const ResizeDirection& direction) { ASSERT_UI_THREAD(); From 686f10c4b9ddeb9f76e00c82f6c5029cdb83c4f8 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Tue, 5 May 2026 14:08:26 -0500 Subject: [PATCH 4/4] fix the phrasing --- src/cascadia/TerminalApp/Tab.cpp | 2 +- src/cascadia/TerminalApp/TerminalPage.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cascadia/TerminalApp/Tab.cpp b/src/cascadia/TerminalApp/Tab.cpp index 66f348f3253..da4d0896aed 100644 --- a/src/cascadia/TerminalApp/Tab.cpp +++ b/src/cascadia/TerminalApp/Tab.cpp @@ -844,7 +844,7 @@ namespace winrt::TerminalApp::implementation // Arguments: // - direction: The direction to move the separator in. // Return Value: - // - true if a resize was performed, false otherwise + // - whether a pane was resized bool Tab::ResizePane(const ResizeDirection& direction) { ASSERT_UI_THREAD(); diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index 02b46f67535..cfffdf9a38b 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -2900,7 +2900,7 @@ namespace winrt::TerminalApp::implementation // Arguments: // - direction: The direction to move the separator in. // Return Value: - // - true if a resize was performed, false otherwise + // - whether a pane was resized bool TerminalPage::_ResizePane(const ResizeDirection& direction) { if (const auto tabImpl{ _GetFocusedTabImpl() })