diff options
Diffstat (limited to 'widgets/authinfo.go')
-rw-r--r-- | widgets/authinfo.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/widgets/authinfo.go b/widgets/authinfo.go index e773240e..a57d8a13 100644 --- a/widgets/authinfo.go +++ b/widgets/authinfo.go @@ -25,20 +25,17 @@ func (a *AuthInfo) Draw(ctx *ui.Context) { defaultStyle := a.uiConfig.GetStyle(config.STYLE_DEFAULT) ctx.Fill(0, 0, ctx.Width(), ctx.Height(), ' ', defaultStyle) var text string - if a.authdetails == nil { + switch { + case a.authdetails == nil: text = "(no header)" ctx.Printf(0, 0, defaultStyle, text) - } else if a.authdetails.Err != nil { + case a.authdetails.Err != nil: style := a.uiConfig.GetStyle(config.STYLE_ERROR) text = a.authdetails.Err.Error() ctx.Printf(0, 0, style, text) - } else { + default: checkBounds := func(x int) bool { - if x < ctx.Width() { - return true - } else { - return false - } + return x < ctx.Width() } setResult := func(result auth.Result) (string, tcell.Style) { switch result { |