summaryrefslogtreecommitdiff
path: root/src/ui/text.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-04 11:24:13 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-04 11:24:13 +0300
commit7a69d53ba72f9e5581c781dd4c54dd3a3e6b89b4 (patch)
treed84af4e3d72eb02c7cc3a15e08ceda42f59f9b02 /src/ui/text.c
parent7fff669f5be5021862ae634b65f3ab18b17021dd (diff)
Remember scroll positions on visited pages
Diffstat (limited to 'src/ui/text.c')
-rw-r--r--src/ui/text.c8
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,