added hotkeys to loop through panes - fixes #3417

This commit is contained in:
Eugene Pankov 2021-06-28 22:41:08 +02:00
parent 6197215500
commit 0452f42c41
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
5 changed files with 37 additions and 0 deletions

View file

@ -238,6 +238,12 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
case 'pane-nav-down':
this.navigate('b')
break
case 'pane-nav-previous':
this.navigateLinear(-1)
break
case 'pane-nav-next':
this.navigateLinear(1)
break
case 'pane-maximize':
if (this.maximizedTab) {
this.maximize(null)
@ -433,6 +439,17 @@ export class SplitTabComponent extends BaseTabComponent implements AfterViewInit
}
}
navigateLinear (delta: number): void {
if (!this.focusedTab) {
return
}
const relativeTo: BaseTabComponent = this.focusedTab
const all = this.getAllTabs()
const target = all[(all.indexOf(relativeTo) + delta + all.length) % all.length]
this.focus(target)
}
async splitTab (tab: BaseTabComponent, dir: SplitDirection): Promise<BaseTabComponent|null> {
const newTab = await this.tabsService.duplicate(tab)
if (newTab) {

View file

@ -62,6 +62,10 @@ hotkeys:
- 'Ctrl-Alt-Up'
pane-nav-left:
- 'Ctrl-Alt-Left'
pane-nav-previous:
- 'Ctrl-Alt-['
pane-nav-next:
- 'Ctrl-Alt-]'
pane-maximize:
- 'Ctrl-Alt-Enter'
close-pane: []

View file

@ -60,6 +60,10 @@ hotkeys:
- '⌘-⌥-Up'
pane-nav-left:
- '⌘-⌥-Left'
pane-nav-previous:
- '⌘-⌥-['
pane-nav-next:
- '⌘-⌥-]'
pane-maximize:
- '⌘-⌥-Enter'
close-pane:

View file

@ -63,6 +63,10 @@ hotkeys:
- 'Ctrl-Alt-Up'
pane-nav-left:
- 'Ctrl-Alt-Left'
pane-nav-previous:
- 'Ctrl-Alt-['
pane-nav-next:
- 'Ctrl-Alt-]'
pane-maximize:
- 'Ctrl-Alt-Enter'
close-pane: []

View file

@ -157,6 +157,14 @@ export class AppHotkeyProvider extends HotkeyProvider {
id: 'pane-nav-right',
name: 'Focus the pane on the right',
},
{
id: 'pane-nav-previous',
name: 'Focus previous pane',
},
{
id: 'pane-nav-next',
name: 'Focus next pane',
},
{
id: 'close-pane',
name: 'Close focused pane',