about summary refs log tree commit diff stats
path: root/lib/templates/template.go
diff options
context:
space:
mode:
authorLeszek CimaƂa <ernierasta@zori.cz>2020-01-08 21:44:17 +0100
committerDrew DeVault <sir@cmpwn.com>2020-01-09 14:31:19 -0500
commitfe9ec67eca201c75c09f1ef7ff51ac189de3a4d4 (patch)
tree204d719625fdb2581e033b8dfc90ef76e117d49d /lib/templates/template.go
parentd238272bdbbe5f417c3ec07e5ce39a77a9a97bd9 (diff)
downloadaerc-fe9ec67eca201c75c09f1ef7ff51ac189de3a4d4.tar.gz
template: remove last \n to fix additional new lines after quote
Diffstat (limited to 'lib/templates/template.go')
-rw-r--r--lib/templates/template.go2
1 files changed, 2 insertions, 0 deletions
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 {