1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-18 05:17:55 +02:00

small refactor

This commit is contained in:
Jesse Duffield 2021-04-05 00:44:13 +10:00
parent 39ae122304
commit b6cc1c9492
2 changed files with 4 additions and 9 deletions

View File

@ -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()

View File

@ -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
}
}