From fe9ec67eca201c75c09f1ef7ff51ac189de3a4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leszek=20Cima=C5=82a?= Date: Wed, 8 Jan 2020 21:44:17 +0100 Subject: template: remove last \n to fix additional new lines after quote --- lib/templates/template.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/templates') diff --git a/lib/templates/template.go b/lib/templates/template.go index 6eae5a2..5402472 100644 --- a/lib/templates/template.go +++ b/lib/templates/template.go @@ -97,6 +97,7 @@ func wrapLine(text string, lineWidth int) string { func wrapText(text string, lineWidth int) string { text = strings.ReplaceAll(text, "\r\n", "\n") + text = strings.TrimRight(text, "\n") lines := strings.Split(text, "\n") var wrapped strings.Builder @@ -118,6 +119,7 @@ func wrapText(text string, lineWidth int) string { // quote prepends "> " in front of every line in text func quote(text string) string { text = strings.ReplaceAll(text, "\r\n", "\n") + text = strings.TrimRight(text, "\n") lines := strings.Split(text, "\n") var quoted strings.Builder for _, line := range lines { -- cgit v1.2.3