From a048e20690a9d81ca002055752f4265dc216d654 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Fri, 25 Sep 2020 13:05:13 -0400 Subject: [PATCH] show: Fix bug with multi-line discussion comment output Currently when outputting a multi-line comment in a discussion the output looks like prarit commented at 2020-09-25 15:47:37.445 +0000 UTC The quick brown fox jumps When it should be prarit commented at 2020-09-25 15:47:37.445 +0000 UTC The quick brown fox jumps This occurs because only the first line the note Body is "tabbed" over. Each newline should be tabbed over as well. Fix bug with multi-line discussion comment output. Signed-off-by: Prarit Bhargava --- cmd/issue_show.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/issue_show.go b/cmd/issue_show.go index b59bdf56..b367d682 100644 --- a/cmd/issue_show.go +++ b/cmd/issue_show.go @@ -163,6 +163,8 @@ func PrintDiscussions(discussions []*gitlab.Discussion, since string, idstr stri indentHeader = " " } } + + noteBody := strings.Replace(note.Body, "\n", "\n"+indentHeader, -1) printit := color.New().PrintfFunc() printit(` %s-----------------------------------`, indentHeader) @@ -176,7 +178,7 @@ func PrintDiscussions(discussions []*gitlab.Discussion, since string, idstr stri %s%s `, indentHeader, note.ID, note.Author.Username, commented, time.Time(*note.UpdatedAt).String(), - indentNote, note.Body) + indentNote, noteBody) } }