redraw on resize

This commit is contained in:
Gustavo Chain 2020-02-13 19:08:48 +01:00
parent b2f6b5a319
commit 03053cd862
No known key found for this signature in database
GPG Key ID: DA7C1746DC118A46

View File

@ -33,10 +33,12 @@ func New() (*UI, error) {
return nil, err
}
ui := &UI{gui: gui}
gui.SetManager(ui)
gui.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit)
gui.SetKeybinding("", 'q', gocui.ModNone, quit)
return &UI{gui: gui}, nil
return ui, nil
}
func quit(*gocui.Gui, *gocui.View) error { return gocui.ErrQuit }
@ -71,12 +73,10 @@ func (ui *UI) Render(resp *client.Response) {
ui.state.projected = bs
}
ui.gui.Update(func(g *gocui.Gui) error {
return ui.update(g)
})
ui.gui.Update(ui.Layout)
}
func (ui *UI) update(g *gocui.Gui) error {
func (ui *UI) Layout(g *gocui.Gui) error {
x, y := g.Size()
// whether or not use vertical layout