1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00

Use static context

This commit is contained in:
Cristian Betivu 2021-06-15 19:58:43 +02:00 committed by Jesse Duffield
parent 23285eab40
commit 39c8577074
2 changed files with 4 additions and 13 deletions

View File

@ -74,13 +74,11 @@ 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

@ -394,15 +394,8 @@ func (gui *Gui) pageDelta(view *gocui.View) int {
}
func getTabbedView(gui *Gui) *gocui.View {
v := gui.g.CurrentView()
if v == nil {
return nil
}
// if the action is invoked via the Options menu,
// we need to execute it against the parent view
if v.Name() == "menu" {
v = v.ParentView
}
return v
// It safe assumption that only static contexts have tabs
context := gui.currentStaticContext()
view, _ := gui.g.View(context.GetViewName())
return view
}