diff options
Diffstat (limited to 'pkg/gui/list_context.go')
-rw-r--r-- | pkg/gui/list_context.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index 7a1248d22..9454aadf9 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -11,9 +11,12 @@ type ListContext struct { OnFocusLost func() error OnItemSelect func() error OnClickSelectedItem func() error - Gui *Gui - RendersToMainView bool - Kind int + + // OnFocus assumes that the content of the context has already been rendered to the view. OnRender is the function which actually renders the content to the view + OnRender func() error + Gui *Gui + RendersToMainView bool + Kind int } func (lc *ListContext) GetKey() string { @@ -40,6 +43,10 @@ func (lc *ListContext) HandleFocus() error { return lc.OnFocus() } +func (lc *ListContext) HandleRender() error { + return lc.OnRender() +} + func (lc *ListContext) handlePrevLine(g *gocui.Gui, v *gocui.View) error { return lc.handleLineChange(-1) } @@ -187,9 +194,9 @@ func (gui *Gui) branchesListContext() *ListContext { GetSelectedLineIdxPtr: func() *int { return &gui.State.Panels.Branches.SelectedLine }, OnFocus: gui.handleBranchSelect, OnItemSelect: gui.handleBranchSelect, - Gui: gui, - RendersToMainView: true, - Kind: SIDE_CONTEXT, + Gui: gui, + RendersToMainView: true, + Kind: SIDE_CONTEXT, } } |