add shortcut alt-* for select tab (#623)
* add shortcut alt-* for select tab * all right, 0 for 10th
This commit is contained in:
parent
6c98fc19f5
commit
f74a9d3e0b
|
@ -329,6 +329,7 @@ namespace winrt::TerminalApp::implementation
|
||||||
bindings.ScrollDown([this]() { _DoScroll(1); });
|
bindings.ScrollDown([this]() { _DoScroll(1); });
|
||||||
bindings.NextTab([this]() { _SelectNextTab(true); });
|
bindings.NextTab([this]() { _SelectNextTab(true); });
|
||||||
bindings.PrevTab([this]() { _SelectNextTab(false); });
|
bindings.PrevTab([this]() { _SelectNextTab(false); });
|
||||||
|
bindings.SwitchToTab([this](const auto index) { _SelectTab({ index }); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method Description:
|
// Method Description:
|
||||||
|
@ -715,6 +716,16 @@ namespace winrt::TerminalApp::implementation
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method Description:
|
||||||
|
// - Sets focus to the desired tab.
|
||||||
|
void App::_SelectTab(const int tabIndex)
|
||||||
|
{
|
||||||
|
if (tabIndex >= 0 && tabIndex < _tabs.size())
|
||||||
|
{
|
||||||
|
_SetFocusedTabIndex(tabIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Method Description:
|
// Method Description:
|
||||||
// - Responds to the TabView control's Selection Changed event (to move a
|
// - Responds to the TabView control's Selection Changed event (to move a
|
||||||
// new terminal control into focus.)
|
// new terminal control into focus.)
|
||||||
|
|
|
@ -87,6 +87,7 @@ namespace winrt::TerminalApp::implementation
|
||||||
void _OpenNewTab(std::optional<int> profileIndex);
|
void _OpenNewTab(std::optional<int> profileIndex);
|
||||||
void _CloseFocusedTab();
|
void _CloseFocusedTab();
|
||||||
void _SelectNextTab(const bool bMoveRight);
|
void _SelectNextTab(const bool bMoveRight);
|
||||||
|
void _SelectTab(const int tabIndex);
|
||||||
|
|
||||||
void _SetFocusedTabIndex(int tabIndex);
|
void _SetFocusedTabIndex(int tabIndex);
|
||||||
int _GetFocusedTabIndex() const;
|
int _GetFocusedTabIndex() const;
|
||||||
|
|
|
@ -93,6 +93,37 @@ namespace winrt::TerminalApp::implementation
|
||||||
case ShortcutAction::PrevTab:
|
case ShortcutAction::PrevTab:
|
||||||
_PrevTabHandlers();
|
_PrevTabHandlers();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case ShortcutAction::SwitchToTab0:
|
||||||
|
_SwitchToTabHandlers(0);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab1:
|
||||||
|
_SwitchToTabHandlers(1);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab2:
|
||||||
|
_SwitchToTabHandlers(2);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab3:
|
||||||
|
_SwitchToTabHandlers(3);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab4:
|
||||||
|
_SwitchToTabHandlers(4);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab5:
|
||||||
|
_SwitchToTabHandlers(5);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab6:
|
||||||
|
_SwitchToTabHandlers(6);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab7:
|
||||||
|
_SwitchToTabHandlers(7);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab8:
|
||||||
|
_SwitchToTabHandlers(8);
|
||||||
|
return true;
|
||||||
|
case ShortcutAction::SwitchToTab9:
|
||||||
|
_SwitchToTabHandlers(9);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,18 @@ namespace TerminalApp
|
||||||
NewWindow,
|
NewWindow,
|
||||||
CloseWindow,
|
CloseWindow,
|
||||||
CloseTab,
|
CloseTab,
|
||||||
SwitchToTab,
|
|
||||||
NextTab,
|
NextTab,
|
||||||
PrevTab,
|
PrevTab,
|
||||||
|
SwitchToTab0,
|
||||||
|
SwitchToTab1,
|
||||||
|
SwitchToTab2,
|
||||||
|
SwitchToTab3,
|
||||||
|
SwitchToTab4,
|
||||||
|
SwitchToTab5,
|
||||||
|
SwitchToTab6,
|
||||||
|
SwitchToTab7,
|
||||||
|
SwitchToTab8,
|
||||||
|
SwitchToTab9,
|
||||||
IncreaseFontSize,
|
IncreaseFontSize,
|
||||||
DecreaseFontSize,
|
DecreaseFontSize,
|
||||||
ScrollUp,
|
ScrollUp,
|
||||||
|
@ -37,9 +46,9 @@ namespace TerminalApp
|
||||||
delegate void NewWindowEventArgs();
|
delegate void NewWindowEventArgs();
|
||||||
delegate void CloseWindowEventArgs();
|
delegate void CloseWindowEventArgs();
|
||||||
delegate void CloseTabEventArgs();
|
delegate void CloseTabEventArgs();
|
||||||
delegate void SwitchToTabEventArgs();
|
|
||||||
delegate void NextTabEventArgs();
|
delegate void NextTabEventArgs();
|
||||||
delegate void PrevTabEventArgs();
|
delegate void PrevTabEventArgs();
|
||||||
|
delegate void SwitchToTabEventArgs(Int32 profileIndex);
|
||||||
delegate void IncreaseFontSizeEventArgs();
|
delegate void IncreaseFontSizeEventArgs();
|
||||||
delegate void DecreaseFontSizeEventArgs();
|
delegate void DecreaseFontSizeEventArgs();
|
||||||
delegate void ScrollUpEventArgs();
|
delegate void ScrollUpEventArgs();
|
||||||
|
|
|
@ -221,6 +221,37 @@ void CascadiaSettings::_CreateDefaultKeybindings()
|
||||||
keyBindings.SetKeyBinding(ShortcutAction::ScrollDown,
|
keyBindings.SetKeyBinding(ShortcutAction::ScrollDown,
|
||||||
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
KeyChord{ KeyModifiers::Ctrl | KeyModifiers::Shift,
|
||||||
VK_NEXT });
|
VK_NEXT });
|
||||||
|
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab0,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('1') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab1,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('2') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab2,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('3') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab3,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('4') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab4,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('5') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab5,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('6') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab6,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('7') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab7,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('8') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab8,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('9') });
|
||||||
|
keyBindings.SetKeyBinding(ShortcutAction::SwitchToTab9,
|
||||||
|
KeyChord{ KeyModifiers::Alt,
|
||||||
|
static_cast<int>('0') });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Method Description:
|
// Method Description:
|
||||||
|
|
Loading…
Reference in a new issue