From f7d99c5effd102baa97b5905b10ee97f8964c4d9 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Tue, 6 Oct 2020 20:00:47 -0700 Subject: [PATCH] Don't trim whitespace from beginning of widget Some widgets format the output using whitespace padding at the beginning. Signed-off-by: Chris Cummer --- modules/clocks/display.go | 6 ++---- view/text_widget.go | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/clocks/display.go b/modules/clocks/display.go index 7c1a5bca..ffa986f9 100644 --- a/modules/clocks/display.go +++ b/modules/clocks/display.go @@ -1,15 +1,13 @@ package clocks -import ( - "fmt" -) +import "fmt" func (widget *Widget) display(clocks []Clock, dateFormat string, timeFormat string) { str := "" + if len(clocks) == 0 { str = fmt.Sprintf("\n%s", " no timezone data available") } else { - for idx, clock := range clocks { str += fmt.Sprintf( " [%s]%-12s %-10s %7s[white]\n", diff --git a/view/text_widget.go b/view/text_widget.go index 09f92df4..f143effb 100644 --- a/view/text_widget.go +++ b/view/text_widget.go @@ -38,7 +38,9 @@ func (widget *TextWidget) Redraw(data func() (string, string, bool)) { widget.View.Clear() widget.View.SetWrap(wrap) widget.View.SetTitle(widget.ContextualTitle(title)) - widget.View.SetText(strings.TrimSpace(content)) + // widget.View.SetText(strings.TrimSpace(content)) + widget.View.SetText(strings.TrimRight(content, "\n")) + // widget.View.SetText(content) }) }