genericise creating new branches off things

This commit is contained in:
Jesse Duffield 2020-08-22 09:55:49 +10:00
parent f858c8e750
commit f63ec38aae
6 changed files with 71 additions and 75 deletions

View file

@ -46,6 +46,7 @@ type Context interface {
SetWindowName(string)
GetKey() string
GetSelectedItemId() string
GetSelectedItem() ListItem
SetParentContext(Context)
GetParentContext() Context
}
@ -63,6 +64,10 @@ func (c BasicContext) SetWindowName(windowName string) {
panic("can't set window name on basic context")
}
func (c BasicContext) GetSelectedItem() ListItem {
return nil
}
func (c BasicContext) GetWindowName() string {
// TODO: fix this up
return c.GetViewName()
@ -677,3 +682,14 @@ func (gui *Gui) rerenderView(viewName string) error {
return context.HandleRender()
}
func (gui *Gui) getCurrentSideView() *gocui.View {
currentSideContext := gui.currentSideContext()
if currentSideContext == nil {
return nil
}
view, _ := gui.g.View(currentSideContext.GetViewName())
return view
}