diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-16 21:01:17 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-02-16 21:01:17 +1100 |
commit | e011e9bc4238b97a70ac6e4b35a862a028ce55e4 (patch) | |
tree | b4812f422ee3b38844796617299a5cecc7835369 /pkg/gui/gui.go | |
parent | ad93b4c863dfaa6a1cb6bb740d0dba87fef14404 (diff) |
more work on rebasing feature
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r-- | pkg/gui/gui.go | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 637db680a..dfaf48cf7 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -217,6 +217,9 @@ func (gui *Gui) getFocusLayout() func(g *gocui.Gui) error { return func(g *gocui.Gui) error { v := gui.g.CurrentView() if v != focusedView { + if err := gui.onFocusChange(); err != nil { + return err + } if err := gui.onFocusLost(focusedView); err != nil { return err } @@ -229,6 +232,14 @@ func (gui *Gui) getFocusLayout() func(g *gocui.Gui) error { } } +func (gui *Gui) onFocusChange() error { + currentView := gui.g.CurrentView() + for _, view := range gui.g.Views() { + view.Highlight = view == currentView + } + return gui.setMainTitle() +} + func (gui *Gui) onFocusLost(v *gocui.View) error { if v == nil { return nil @@ -306,31 +317,6 @@ func (gui *Gui) layout(g *gocui.Gui) error { v.FgColor = gocui.ColorWhite } - // v, err = g.SetView("staging", leftSideWidth+panelSpacing, 0, width-1, optionsTop, gocui.LEFT) - // if err != nil { - // if err.Error() != "unknown view" { - // return err - // } - // v.Title = gui.Tr.SLocalize("StagingTitle") - // v.Highlight = true - // v.FgColor = gocui.ColorWhite - // if _, err := g.SetViewOnBottom("staging"); err != nil { - // return err - // } - // } - - // v, err = g.SetView("merging", leftSideWidth+panelSpacing, 0, width-1, optionsTop, gocui.LEFT) - // if err != nil { - // if err.Error() != "unknown view" { - // return err - // } - // v.Title = gui.Tr.SLocalize("MergingTitle") - // v.FgColor = gocui.ColorWhite - // if _, err := g.SetViewOnBottom("merging"); err != nil { - // return err - // } - // } - if v, err := g.SetView("status", 0, 0, leftSideWidth, statusFilesBoundary, gocui.BOTTOM|gocui.RIGHT); err != nil { if err.Error() != "unknown view" { return err |