From 2388c3ee9a5dd70cf953b4fbdd81f847c8a8d24f Mon Sep 17 00:00:00 2001 From: mjarkk Date: Mon, 6 May 2019 20:04:54 +0200 Subject: [PATCH] Fixed some sugestions from jesseduffield --- pkg/gui/gui.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 4e66a1314..101e297e2 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -315,10 +315,8 @@ func (gui *Gui) layout(g *gocui.Gui) error { } currView := gui.g.CurrentView() - currentCyclebleView := "files" - if currView == nil { - currentCyclebleView = gui.State.PreviousView - } else { + currentCyclebleView := gui.State.PreviousView + if currView != nil { viewName := currView.Name() usePreviouseView := true for _, view := range cyclableViews { @@ -347,10 +345,8 @@ func (gui *Gui) layout(g *gocui.Gui) error { if height < 28 { defaultHeight := 3 - extraHeight := 2 if height < 21 { defaultHeight = 1 - extraHeight = 0 } vHeights = map[string]int{ "status": defaultHeight, @@ -360,7 +356,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { "stash": defaultHeight, "options": defaultHeight, } - vHeights[currentCyclebleView] = height - (defaultHeight * 5) + extraHeight + vHeights[currentCyclebleView] = height - defaultHeight*4 - 1 } optionsVersionBoundary := width - max(len(utils.Decolorise(information)), 1) @@ -484,7 +480,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { } } - if appStatusView, err := g.SetView("appStatus", -1, height+2, width, height, 0); err != nil { + if appStatusView, err := g.SetView("appStatus", -1, height-2, width, height, 0); err != nil { if err.Error() != "unknown view" { return err } @@ -496,7 +492,7 @@ func (gui *Gui) layout(g *gocui.Gui) error { } } - if v, err := g.SetView("information", optionsVersionBoundary-1, height+2, width, height, 0); err != nil { + if v, err := g.SetView("information", optionsVersionBoundary-1, height-2, width, height, 0); err != nil { if err.Error() != "unknown view" { return err }