Skip to content

Commit 39a1ce0

Browse files
PankajBhojwaniDHowett
authored andcommitted
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. (cherry picked from commit 8b669b5)
1 parent 1394147 commit 39a1ce0

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

0 commit comments

Comments
 (0)