1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-20 05:19:24 +02:00

Use parent view for tab navigation

This commit is contained in:
Cristian Betivu 2021-06-06 12:41:55 +02:00 committed by Jesse Duffield
parent 2b9df0ea06
commit 0c135515a5
2 changed files with 16 additions and 2 deletions

View File

@ -74,11 +74,13 @@ func (gui *Gui) createMenu(title string, items []*menuItem, createMenuOptions cr
list := utils.RenderDisplayStrings(stringArrays)
parentView := gui.g.CurrentView()
x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(false, list)
menuView, _ := gui.g.SetView("menu", x0, y0, x1, y1, 0)
menuView.Title = title
menuView.FgColor = theme.GocuiDefaultTextColor
menuView.ContainsList = true
menuView.ParentView = parentView
menuView.Clear()
menuView.SetOnSelectItem(gui.onSelectItemWrapper(func(selectedLine int) error {
return nil

View File

@ -358,7 +358,7 @@ func (gui *Gui) onViewTabClick(viewName string, tabIndex int) error {
}
func (gui *Gui) handleNextTab() error {
v := gui.g.CurrentView()
v := getTabbedView(gui)
if v == nil {
return nil
}
@ -370,7 +370,7 @@ func (gui *Gui) handleNextTab() error {
}
func (gui *Gui) handlePrevTab() error {
v := gui.g.CurrentView()
v := getTabbedView(gui)
if v == nil {
return nil
}
@ -392,3 +392,15 @@ func (gui *Gui) pageDelta(view *gocui.View) int {
return delta
}
func getTabbedView(gui *Gui) *gocui.View {
v := gui.g.CurrentView()
if v == nil {
return nil
}
if v.Name() == "menu" {
v = v.ParentView
}
return v
}