From 0f36063696eb53619f1d1d311c6940c8fc990a50 Mon Sep 17 00:00:00 2001 From: Ying Fan Chong Date: Fri, 2 Oct 2020 20:53:33 +0800 Subject: [PATCH] Prevent extra empty line in highlightable text --- view/text_widget.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/view/text_widget.go b/view/text_widget.go index 7aa94eb8..09f92df4 100644 --- a/view/text_widget.go +++ b/view/text_widget.go @@ -1,6 +1,8 @@ package view import ( + "strings" + "github.com/rivo/tview" "github.com/wtfutil/wtf/cfg" "github.com/wtfutil/wtf/wtf" @@ -36,7 +38,7 @@ 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(content) + widget.View.SetText(strings.TrimSpace(content)) }) }