"strings"
"time"
+ "github.com/kennygrant/sanitize"
"github.com/layeh/barnard/uiterm"
"github.com/layeh/gumble/gumble"
- "github.com/kennygrant/sanitize"
)
const (
func (b *Barnard) OnFocusPress(ui *uiterm.Ui, key uiterm.Key) {
active := b.Ui.Active()
- if active == &b.UiInput {
+ if active == uiViewInput {
b.Ui.SetActive(uiViewTree)
- } else if active == &b.UiTree {
+ } else if active == uiViewTree {
b.Ui.SetActive(uiViewInput)
}
}
}
type uiElement struct {
+ Name string
X0, Y0, X1, Y1 int
View View
}
}
}
-func (ui *Ui) Active() View {
- return ui.activeElement.View
+func (ui *Ui) Active() string {
+ return ui.activeElement.Name
}
func (ui *Ui) SetActive(name string) {
return errors.New("view already exists")
}
ui.elements[name] = &uiElement{
+ Name: name,
View: view,
}
view.uiInitialize(ui)