_examples/widgets.go: Minor refactoring

This commit is contained in:
Roi Martin 2016-10-24 16:00:18 +02:00
parent e5517b913e
commit 89ecdb537d
1 changed files with 2 additions and 4 deletions

View File

@ -73,10 +73,8 @@ func (w *StatusbarWidget) Val() float32 {
func (w *StatusbarWidget) Layout(g *gocui.Gui) error { func (w *StatusbarWidget) Layout(g *gocui.Gui) error {
v, err := g.SetView(w.name, w.x, w.y, w.x+w.w, w.y+2) v, err := g.SetView(w.name, w.x, w.y, w.x+w.w, w.y+2)
if err != nil { if err != nil && err != gocui.ErrUnknownView {
if err != gocui.ErrUnknownView { return err
return err
}
} }
v.Clear() v.Clear()
val := int(w.val * float32(w.w-1)) val := int(w.val * float32(w.w-1))