Skip to content

Commit dadde2f

Browse files
nmurrell07DHowett
andauthored
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 <nmurrell07@users.noreply.github.com> Co-authored-by: Dustin L. Howett <dustin@howett.net>
1 parent 8edac5f commit dadde2f

5 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/cascadia/TerminalApp/AppActionHandlers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ namespace winrt::TerminalApp::implementation
499499
}
500500
else
501501
{
502-
_ResizePane(realArgs.ResizeDirection());
503-
args.Handled(true);
502+
const auto resizeSucceeded = _ResizePane(realArgs.ResizeDirection());
503+
args.Handled(resizeSucceeded);
504504
}
505505
}
506506
}

src/cascadia/TerminalApp/Tab.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,14 +844,14 @@ namespace winrt::TerminalApp::implementation
844844
// Arguments:
845845
// - direction: The direction to move the separator in.
846846
// Return Value:
847-
// - <none>
848-
void Tab::ResizePane(const ResizeDirection& direction)
847+
// - whether a pane was resized
848+
bool Tab::ResizePane(const ResizeDirection& direction)
849849
{
850850
ASSERT_UI_THREAD();
851851

852852
// NOTE: This _must_ be called on the root pane, so that it can propagate
853853
// throughout the entire tree.
854-
_rootPane->ResizePane(direction);
854+
return _rootPane->ResizePane(direction);
855855
}
856856

857857
// Method Description:

src/cascadia/TerminalApp/Tab.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace winrt::TerminalApp::implementation
5353
const float splitSize,
5454
winrt::Windows::Foundation::Size availableSpace) const;
5555

56-
void ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
56+
bool ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
5757
bool NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction);
5858
bool SwapPane(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction);
5959
bool FocusPane(const uint32_t id);

src/cascadia/TerminalApp/TerminalPage.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,14 +2900,15 @@ namespace winrt::TerminalApp::implementation
29002900
// Arguments:
29012901
// - direction: The direction to move the separator in.
29022902
// Return Value:
2903-
// - <none>
2904-
void TerminalPage::_ResizePane(const ResizeDirection& direction)
2903+
// - whether a pane was resized
2904+
bool TerminalPage::_ResizePane(const ResizeDirection& direction)
29052905
{
29062906
if (const auto tabImpl{ _GetFocusedTabImpl() })
29072907
{
29082908
_UnZoomIfNeeded();
2909-
tabImpl->ResizePane(direction);
2909+
return tabImpl->ResizePane(direction);
29102910
}
2911+
return false;
29112912
}
29122913

29132914
// Method Description:

src/cascadia/TerminalApp/TerminalPage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ namespace winrt::TerminalApp::implementation
426426
const Microsoft::Terminal::Settings::Model::SplitDirection splitType,
427427
const float splitSize,
428428
std::shared_ptr<Pane> newPane);
429-
void _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
429+
bool _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
430430
void _ToggleSplitOrientation();
431431

432432
void _ScrollPage(ScrollDirection scrollDirection);

0 commit comments

Comments
 (0)