diff options
Diffstat (limited to 'src/ui/text.c')
-rw-r--r-- | src/ui/text.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/ui/text.c b/src/ui/text.c index 50b3bbab..f562e642 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -356,6 +356,7 @@ static iRect run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLe | |||
356 | iChar prevCh = 0; | 356 | iChar prevCh = 0; |
357 | for (const char *chPos = text.start; chPos != text.end; ) { | 357 | for (const char *chPos = text.start; chPos != text.end; ) { |
358 | iAssert(chPos < text.end); | 358 | iAssert(chPos < text.end); |
359 | const char *currentPos = chPos; | ||
359 | if (*chPos == 0x1b) { | 360 | if (*chPos == 0x1b) { |
360 | /* ANSI escape. */ | 361 | /* ANSI escape. */ |
361 | chPos++; | 362 | chPos++; |
@@ -394,7 +395,12 @@ static iRect run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLe | |||
394 | int x2 = x1 + glyph->rect[hoff].size.x; | 395 | int x2 = x1 + glyph->rect[hoff].size.x; |
395 | /* Out of the allotted space? */ | 396 | /* Out of the allotted space? */ |
396 | if (xposLimit > 0 && x2 > xposLimit) { | 397 | if (xposLimit > 0 && x2 > xposLimit) { |
397 | *continueFrom_out = lastWordEnd; | 398 | if (lastWordEnd != text.start) { |
399 | *continueFrom_out = lastWordEnd; | ||
400 | } | ||
401 | else { | ||
402 | *continueFrom_out = currentPos; /* forced break */ | ||
403 | } | ||
398 | break; | 404 | break; |
399 | } | 405 | } |
400 | const SDL_Rect dst = { x1 + glyph->d[hoff].x, | 406 | const SDL_Rect dst = { x1 + glyph->d[hoff].x, |