summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-05 00:44:13 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commitb6cc1c949221810966b3c3cb4a386dc6c7faa023 (patch)
tree3d497d6fee264bb253ca305f0f1d80119c86cd2b /pkg/gui
parent39ae122304868a4de60659291e9220b4bab2dde1 (diff)
small refactor
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/context.go9
-rw-r--r--pkg/gui/global_handlers.go4
2 files changed, 4 insertions, 9 deletions
diff --git a/pkg/gui/context.go b/pkg/gui/context.go
index 94e227d0e..67ded3060 100644
--- a/pkg/gui/context.go
+++ b/pkg/gui/context.go
@@ -769,13 +769,8 @@ func (gui *Gui) contextForContextKey(contextKey ContextKey) (Context, bool) {
return nil, false
}
-func (gui *Gui) rerenderView(viewName string) error {
- v, err := gui.g.View(viewName)
- if err != nil {
- return nil
- }
-
- contextKey := ContextKey(v.Context)
+func (gui *Gui) rerenderView(view *gocui.View) error {
+ contextKey := ContextKey(view.Context)
context := gui.mustContextForContextKey(contextKey)
return context.HandleRender()
diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go
index d4e0923b7..25aafa588 100644
--- a/pkg/gui/global_handlers.go
+++ b/pkg/gui/global_handlers.go
@@ -13,8 +13,8 @@ import (
// these views need to be re-rendered when the screen mode changes. The commits view,
// for example, will show authorship information in half and full screen mode.
func (gui *Gui) rerenderViewsWithScreenModeDependentContent() error {
- for _, viewName := range []string{"branches", "commits"} {
- if err := gui.rerenderView(viewName); err != nil {
+ for _, view := range []*gocui.View{gui.Views.Branches, gui.Views.Commits} {
+ if err := gui.rerenderView(view); err != nil {
return err
}
}