1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

When using the panel jump keys and the target panel is already active, switch tabs

This commit is contained in:
Stefan Haller
2024-08-03 15:55:28 +02:00
parent c72be6cbf3
commit b37d6dcd1c
4 changed files with 44 additions and 2 deletions

View File

@ -10,15 +10,18 @@ import (
type JumpToSideWindowController struct {
baseController
c *ControllerCommon
c *ControllerCommon
nextTabFunc func() error
}
func NewJumpToSideWindowController(
c *ControllerCommon,
nextTabFunc func() error,
) *JumpToSideWindowController {
return &JumpToSideWindowController{
baseController: baseController{},
c: c,
nextTabFunc: nextTabFunc,
}
}
@ -46,6 +49,10 @@ func (self *JumpToSideWindowController) GetKeybindings(opts types.KeybindingsOpt
func (self *JumpToSideWindowController) goToSideWindow(window string) func() error {
return func() error {
if self.c.Helpers().Window.CurrentWindow() == window {
return self.nextTabFunc()
}
context := self.c.Helpers().Window.GetContextForWindow(window)
return self.c.PushContext(context)