peterbrittain / asciimatics

A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Apache License 2.0
3.64k stars 238 forks source link

Fix speech bubble height #256

Closed mauri-medina closed 4 years ago

mauri-medina commented 4 years ago

Issues fixed by this PR

Height of the speech bubbles that not have a tail

What does this implement/fix?

The way a render calculate the max height of its image its counting the lines in the image

self._max_height = max(len(image), self._max_height)

When constructing a speech bubble a new line is always added at the end of the bubble, whether or not it has a tail

 bubble = "╭─" + "─" * max_len + "─╮\n"
            for line in text.split("\n"):
                filler = " " * (max_len - len(line))
                bubble += "│ " + line + filler + " │\n"
            bubble += "╰─" + "─" * max_len + "─╯\n"

the last \n increase the bubble size by one by creating a new empty line. The new line is needed only when there is a tail

peterbrittain commented 4 years ago

Looks good. Just waiting for a fix to the SCM package we use for builds before merging.

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 94.644% when pulling 9e8a7bddfde38d30f88f242bc5674e61ebd24124 on mauri-medina:fix-speech-bubble-height into 2bf39ac7bde5f9bfcd4559476a72220949438629 on peterbrittain:master.