Skip to content

Commit 8b669b5

Browse files
Implement split pane with new tab button (#7117)
Allows splitting pane (with default settings) by holding down ALT and pressing the new tab button ('+') ## PR Checklist * [X] Closes #6757 * [X] Works here. * [X] Manual test (below) * [X] Is core contributor. ## More detailed description Pretty much exactly the code added in #5928 (all credit to @carlos-zamora), but put at the new tab button event binding ## Validation steps Seems to work - holding ALT while pressing '+' opens a pane instead of a tab. Holding ALT while starting up terminal for the first time does not seem to affect the behaviour.
1 parent 6ee8099 commit 8b669b5

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/cascadia/TerminalApp/TerminalPage.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,28 @@ namespace winrt::TerminalApp::implementation
167167
_newTabButton.Click([weakThis{ get_weak() }](auto&&, auto&&) {
168168
if (auto page{ weakThis.get() })
169169
{
170-
page->_OpenNewTab(nullptr);
170+
// if alt is pressed, open a pane
171+
const CoreWindow window = CoreWindow::GetForCurrentThread();
172+
const auto rAltState = window.GetKeyState(VirtualKey::RightMenu);
173+
const auto lAltState = window.GetKeyState(VirtualKey::LeftMenu);
174+
const bool altPressed = WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) ||
175+
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);
176+
177+
// Check for DebugTap
178+
bool debugTap = page->_settings->GlobalSettings().DebugFeaturesEnabled() &&
179+
WI_IsFlagSet(lAltState, CoreVirtualKeyStates::Down) &&
180+
WI_IsFlagSet(rAltState, CoreVirtualKeyStates::Down);
181+
182+
if (altPressed && !debugTap)
183+
{
184+
page->_SplitPane(TerminalApp::SplitState::Automatic,
185+
TerminalApp::SplitType::Manual,
186+
nullptr);
187+
}
188+
else
189+
{
190+
page->_OpenNewTab(nullptr);
191+
}
171192
}
172193
});
173194
_tabView.SelectionChanged({ this, &TerminalPage::_OnTabSelectionChanged });

0 commit comments

Comments
 (0)