From d4d740ad150ab5855c440e5214699497becbcb08 Mon Sep 17 00:00:00 2001 From: Tom McKeesick Date: Fri, 29 Nov 2024 18:38:24 +1100 Subject: [PATCH] fix no-bubble mode bug where the line is printing twice --- src/pokesay/print.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/pokesay/print.go b/src/pokesay/print.go index 96be656..0e56d71 100644 --- a/src/pokesay/print.go +++ b/src/pokesay/print.go @@ -139,20 +139,9 @@ func printSpeechBubble(boxChars *BoxChars, scanner *bufio.Scanner, args Args) { // Prints a single speech bubble line func printSpeechBubbleLine(boxChars *BoxChars, line string, args Args) { - if args.DrawBubble { - lineLength := UnicodeStringLength(line) - if lineLength > args.Width { - fmt.Printf("%s %s\n", boxChars.VerticalEdge, line) - } else if lineLength == args.Width { - fmt.Printf("%s %s %s\n", boxChars.VerticalEdge, line, boxChars.VerticalEdge) - } else { - fmt.Printf( - "%s %s%s %s\n", - boxChars.VerticalEdge, line, strings.Repeat(" ", args.Width-lineLength), boxChars.VerticalEdge, - ) - } - } else { + if !args.DrawBubble { fmt.Println(line) + return } lineLen := UnicodeStringLength(line)