From 2b129536007225d5551f0e98c3ca87c253cbaaad Mon Sep 17 00:00:00 2001 From: Johan Walles Date: Sun, 10 Jan 2021 08:42:34 +0100 Subject: [PATCH] Fix a broken test --- m/reader.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/m/reader.go b/m/reader.go index 82fed9a..6db5fc5 100644 --- a/m/reader.go +++ b/m/reader.go @@ -201,11 +201,15 @@ func newReaderFromStream(reader io.Reader, fromFilter *exec.Cmd) *Reader { // Moar in the bottom left corner of the screen. func NewReaderFromText(name string, text string) *Reader { noExternalNewlines := strings.Trim(text, "\n") + lines := []string{} + if len(noExternalNewlines) > 0 { + lines = strings.Split(noExternalNewlines, "\n") + } done := make(chan bool, 1) done <- true return &Reader{ name: &name, - lines: strings.Split(noExternalNewlines, "\n"), + lines: lines, lock: &sync.Mutex{}, done: done, }