Skip to content

Commit 44dcc86

Browse files
Adds Alt+Click to auto split pane (#5928)
## Summary of the Pull Request Users can now open an auto split pane with the mouse. When opening the dropdown, alt+invoke the profile of choice and it should open in an auto sized pane. ## References #5025 - further discussion there as to whether this actually closes it. ## Detailed Description of the Pull Request / Additional comments Had to do a special check for debugTap because that's triggered by holding both alts. ## Validation Steps Performed alt+click/enter on a new profile. Looks great!
1 parent 9ed776b commit 44dcc86

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/cascadia/TerminalApp/TerminalPage.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,29 @@ namespace winrt::TerminalApp::implementation
364364
{
365365
auto newTerminalArgs = winrt::make_self<winrt::TerminalApp::implementation::NewTerminalArgs>();
366366
newTerminalArgs->ProfileIndex(profileIndex);
367-
page->_OpenNewTab(*newTerminalArgs);
367+
368+
// if alt is pressed, open a pane
369+
const CoreWindow window = CoreWindow::GetForCurrentThread();
370+
const auto rAltState = window.GetKeyState(VirtualKey::RightMenu);
371+
const auto lAltState = window.GetKeyState(VirtualKey::LeftMenu);
372+
const bool altPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) ||
373+
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);
374+
375+
// Check for DebugTap
376+
bool debugTap = page->_settings->GlobalSettings().DebugFeaturesEnabled() &&
377+
WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) &&
378+
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);
379+
380+
if (altPressed && !debugTap)
381+
{
382+
page->_SplitPane(TerminalApp::SplitState::Automatic,
383+
TerminalApp::SplitType::Manual,
384+
*newTerminalArgs);
385+
}
386+
else
387+
{
388+
page->_OpenNewTab(*newTerminalArgs);
389+
}
368390
}
369391
});
370392
newTabFlyout.Items().Append(profileMenuItem);

0 commit comments

Comments
 (0)