mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-05 00:59:19 +02:00
small refactor
This commit is contained in:
@ -769,13 +769,8 @@ func (gui *Gui) contextForContextKey(contextKey ContextKey) (Context, bool) {
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gui *Gui) rerenderView(viewName string) error {
|
func (gui *Gui) rerenderView(view *gocui.View) error {
|
||||||
v, err := gui.g.View(viewName)
|
contextKey := ContextKey(view.Context)
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
contextKey := ContextKey(v.Context)
|
|
||||||
context := gui.mustContextForContextKey(contextKey)
|
context := gui.mustContextForContextKey(contextKey)
|
||||||
|
|
||||||
return context.HandleRender()
|
return context.HandleRender()
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
// these views need to be re-rendered when the screen mode changes. The commits view,
|
// 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.
|
// for example, will show authorship information in half and full screen mode.
|
||||||
func (gui *Gui) rerenderViewsWithScreenModeDependentContent() error {
|
func (gui *Gui) rerenderViewsWithScreenModeDependentContent() error {
|
||||||
for _, viewName := range []string{"branches", "commits"} {
|
for _, view := range []*gocui.View{gui.Views.Branches, gui.Views.Commits} {
|
||||||
if err := gui.rerenderView(viewName); err != nil {
|
if err := gui.rerenderView(view); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user