Skip to content

Commit

Permalink
Merge pull request #41 from tmck-code/fix-negative-width
Browse files Browse the repository at this point in the history
Use printf for printing the text bubble
  • Loading branch information
tmck-code authored Dec 1, 2022
2 parents 5a1f5d7 + 1a6a643 commit ec7e5f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pokesay.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ func randomInt(n int) int {

func printSpeechBubbleLine(line string, width int) {
if len(line) > width {
fmt.Println("|", line)
fmt.Printf("| %s\n", line)
} else {
fmt.Println("|", line, strings.Repeat(" ", width-len(line)-1), "|")
fmt.Printf("| %s%s |\n", line, strings.Repeat(" ", width-len(line)))
}
}

Expand Down

0 comments on commit ec7e5f2

Please sign in to comment.