1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Remove complexity from a lot of string display statements

This commit is contained in:
Chris Cummer
2018-06-21 19:32:32 -07:00
parent 24a46a652b
commit 1a898b05e3
27 changed files with 85 additions and 86 deletions

View File

@@ -32,22 +32,20 @@ func (widget *Widget) Refresh() {
)
widget.UpdateRefreshedAt()
widget.View.Clear()
//widget.View.Clear()
var content string
if err != nil {
widget.View.SetWrap(true)
widget.View.SetTitle(fmt.Sprintf(" %s ", widget.Name))
fmt.Fprintf(widget.View, "%v", err)
content = err.Error()
} else {
widget.View.SetWrap(false)
widget.View.SetTitle(
fmt.Sprintf(
" %s: [green] ",
widget.Name,
),
)
fmt.Fprintf(widget.View, "%s", widget.contentFrom(view))
widget.View.SetTitle(fmt.Sprintf(" %s: [green] ", widget.Name))
content = widget.contentFrom(view)
}
widget.View.SetText(content)
}
/* -------------------- Unexported Functions -------------------- */