From 3389f2f05f2f02457ea70d0cf93653543d2324e9 Mon Sep 17 00:00:00 2001 From: Daniel Pecos Martinez Date: Fri, 25 Jan 2019 20:08:36 +0100 Subject: [PATCH] Removed extra empty line in render for Multiline (#175) --- multiline.go | 3 ++- multiline_test.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/multiline.go b/multiline.go index 6602444e..6007f056 100644 --- a/multiline.go +++ b/multiline.go @@ -29,7 +29,8 @@ var MultilineQuestionTemplate = ` {{- color "green+hb"}}{{ QuestionIcon }} {{color "reset"}} {{- color "default+hb"}}{{ .Message }} {{color "reset"}} {{- if .ShowAnswer}} - {{- "\n"}}{{color "cyan"}}{{.Answer}}{{color "reset"}}{{"\n"}} + {{- "\n"}}{{color "cyan"}}{{.Answer}}{{color "reset"}} + {{- if .Answer }}{{ "\n" }}{{ end }} {{- else }} {{- if .Default}}{{color "white"}}({{.Default}}) {{color "reset"}}{{end}} {{- color "cyan"}}[Enter 2 empty lines to finish]{{color "reset"}} diff --git a/multiline_test.go b/multiline_test.go index de0fcd81..68d4ca5f 100644 --- a/multiline_test.go +++ b/multiline_test.go @@ -42,7 +42,7 @@ func TestMultilineRender(t *testing.T) { "Test Multiline answer output", Multiline{Message: "What is your favorite month:"}, MultilineTemplateData{Answer: "October", ShowAnswer: true}, - fmt.Sprintf("%s What is your favorite month: \nOctober\n", core.QuestionIcon), + fmt.Sprintf("%s What is your favorite month: \nOctober", core.QuestionIcon), }, { "Test Multiline question output without default but with help hidden",