Fixed an old off-by-one error in Text::BreakLines, and updated

DialogOverlay appropriately.
This commit is contained in:
casey langen 2016-09-20 11:14:02 -07:00
parent c9945d5af8
commit 935bf6833a
2 changed files with 4 additions and 2 deletions

View File

@ -149,7 +149,9 @@ void DialogOverlay::RecalculateSize() {
this->width = std::max(0, Screen::GetWidth() - (HORIZONTAL_PADDING * 2)); this->width = std::max(0, Screen::GetWidth() - (HORIZONTAL_PADDING * 2));
if (lastWidth != this->width) { if (lastWidth != this->width) {
messageLines = text::BreakLines(this->message, this->width - 3); /* 4 here: 2 for the frame padding (left/right), then two for the
inner content padding so things aren't bunched up (left/right) */
messageLines = text::BreakLines(this->message, this->width - 4);
} }
this->height = 0; /* top padding */ this->height = 0; /* top padding */

View File

@ -190,7 +190,7 @@ namespace cursespp {
/* we have enough space for this new word. accumulate it. */ /* we have enough space for this new word. accumulate it. */
if (accumLength + extra + wordLength < width) { if (accumLength + extra + wordLength <= width) {
if (extra) { if (extra) {
accum += " "; accum += " ";
} }