Compare commits

...

2 Commits

Author SHA1 Message Date
jlainema
572fe928ec
Merge 9e808832f1 into a3e25e3701 2024-06-20 04:11:24 +00:00
juha
9e808832f1 add next/prev split/tab support for terminal pane 2024-03-05 17:27:16 +02:00

View File

@ -209,16 +209,28 @@ func (t *TermPane) CommandMode() {
})
}
// NextSplit moves to the next split
// NextSplit changes the view to the next split
func (t *TermPane) NextSplit() {
a := t.tab.active
if a < len(t.tab.Panes)-1 {
a++
} else {
a = 0
}
a := Tabs.List[Tabs.Active()]
a.SetActive((a.active + 1) % len(a.Panes))
}
t.tab.SetActive(a)
// PreviousSplit changes the view to the previous split
func (t *TermPane) PreviousSplit() {
a := Tabs.List[Tabs.Active()]
panesLen := len(a.Panes)
a.SetActive((a.active + panesLen - 1) % panesLen)
}
// PreviousTab switches to the previous tab in the tab list
func (t *TermPane) PreviousTab() {
tabsLen := len(Tabs.List)
Tabs.SetActive((Tabs.Active() + tabsLen - 1) % tabsLen)
}
// NextTab switches to the next tab in the tab list
func (t *TermPane) NextTab() {
Tabs.SetActive((Tabs.Active() + 1) % len(Tabs.List))
}
// HandleCommand handles a command for the term pane
@ -228,7 +240,10 @@ func (t *TermPane) HandleCommand(input string) {
// TermKeyActions contains the list of all possible key actions the termpane could execute
var TermKeyActions = map[string]TermKeyAction{
"Exit": (*TermPane).Exit,
"CommandMode": (*TermPane).CommandMode,
"NextSplit": (*TermPane).NextSplit,
"Exit": (*TermPane).Exit,
"CommandMode": (*TermPane).CommandMode,
"NextSplit": (*TermPane).NextSplit,
"PreviousSplit": (*TermPane).PreviousSplit,
"NextTab": (*TermPane).NextTab,
"PreviousTab": (*TermPane).PreviousTab,
}