Skip to content

Commit

Permalink
fix no-bubble mode bug
Browse files Browse the repository at this point in the history
where the line is printing twice
  • Loading branch information
tmck-code committed Nov 29, 2024
1 parent 56cc047 commit d4d740a
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/pokesay/print.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d4d740a

Please sign in to comment.