Skip to content
Snippets Groups Projects
Commit c0a9c942 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix negaitve padding calculation (for center justification of long srings)

parent 06d76184
Branches
No related tags found
No related merge requests found
......@@ -422,8 +422,7 @@ function output_line(str, font) {
} else if (justify === RIGHT_JUSTIFY) {
padding = Math.floor(width - (linewidth + padding));
}
linewidth += padding;
linewidth += Math.max(0, padding);
if(linewidth > width)
throw new Error(format("Rendered line width (%u) > screen width (%u)", linewidth, width));
......@@ -462,7 +461,7 @@ function output_line(str, font) {
// End the line and reset color
out += reset_color();
if(!(justify === RIGHT_JUSTIFY && margin == 0))
if(!(justify === RIGHT_JUSTIFY && padding == 0))
out += "\r\n";
}
return out;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment