summaryrefslogtreecommitdiffstats
path: root/pkg/gui/gui.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-12-07 18:52:31 +1100
committerJesse Duffield <jessedduffield@gmail.com>2018-12-08 11:51:47 +1100
commitff856b763033a241370bfde98d7386b43b7d0893 (patch)
tree9818a3b50f815051a309882e6c48c482bfd7ef3a /pkg/gui/gui.go
parentca3afa2a3905365ec79624e0c9b08865e9ab27ae (diff)
fetching branches without checking out
Diffstat (limited to 'pkg/gui/gui.go')
-rw-r--r--pkg/gui/gui.go29
1 files changed, 17 insertions, 12 deletions
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 6a7eaaf98..26ebd5f2b 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -72,6 +72,9 @@ type Gui struct {
statusManager *statusManager
}
+// for now the staging panel state, unlike the other panel states, is going to be
+// non-mutative, so that we don't accidentally end up
+// with mismatches of data. We might change this in the future
type stagingPanelState struct {
SelectedLine int
StageableLines []int
@@ -233,7 +236,7 @@ func (gui *Gui) layout(g *gocui.Gui) error {
}
return nil
} else {
- g.SetViewOnBottom("limit")
+ _, _ = g.SetViewOnBottom("limit")
}
g.DeleteView("limit")
@@ -364,14 +367,14 @@ func (gui *Gui) layout(g *gocui.Gui) error {
return err
}
- gui.g.SetCurrentView(filesView.Name())
+ if _, err := gui.g.SetCurrentView(filesView.Name()); err != nil {
+ return err
+ }
- gui.refreshSidePanels(gui.g)
- if gui.g.CurrentView().Name() != "menu" {
- if err := gui.renderGlobalOptions(g); err != nil {
- return err
- }
+ if err := gui.refreshSidePanels(gui.g); err != nil {
+ return err
}
+
if err := gui.switchFocus(g, nil, filesView); err != nil {
return err
}
@@ -394,8 +397,10 @@ func (gui *Gui) layout(g *gocui.Gui) error {
}
}
- // TODO: comment-out
- gui.Log.Info(utils.AsJson(gui.State))
+ // here is a good place log some stuff
+ // if you download humanlog and do tail -f development.log | humanlog
+ // this will let you see these branches as prettified json
+ // gui.Log.Info(utils.AsJson(gui.State.Branches[0:4]))
return gui.resizeCurrentPopupPanel(g)
}
@@ -435,8 +440,8 @@ func (gui *Gui) renderAppStatus(g *gocui.Gui) error {
return nil
}
-func (gui *Gui) renderGlobalOptions(g *gocui.Gui) error {
- return gui.renderOptionsMap(g, map[string]string{
+func (gui *Gui) renderGlobalOptions() error {
+ return gui.renderOptionsMap(map[string]string{
"PgUp/PgDn": gui.Tr.SLocalize("scroll"),
"← → ↑ ↓": gui.Tr.SLocalize("navigate"),
"esc/q": gui.Tr.SLocalize("close"),
@@ -467,7 +472,7 @@ func (gui *Gui) Run() error {
}
gui.goEvery(g, time.Second*60, gui.fetch)
- // gui.goEvery(g, time.Second*2, gui.refreshFiles) // TODO: comment back in
+ gui.goEvery(g, time.Second*2, gui.refreshFiles)
gui.goEvery(g, time.Millisecond*50, gui.updateLoader)
gui.goEvery(g, time.Millisecond*50, gui.renderAppStatus)