From 7a69d53ba72f9e5581c781dd4c54dd3a3e6b89b4 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Tue, 4 Aug 2020 11:24:13 +0300 Subject: Remember scroll positions on visited pages --- src/ui/text.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ui/text.c') 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 iChar prevCh = 0; for (const char *chPos = text.start; chPos != text.end; ) { iAssert(chPos < text.end); + const char *currentPos = chPos; if (*chPos == 0x1b) { /* ANSI escape. */ chPos++; @@ -394,7 +395,12 @@ static iRect run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLe int x2 = x1 + glyph->rect[hoff].size.x; /* Out of the allotted space? */ if (xposLimit > 0 && x2 > xposLimit) { - *continueFrom_out = lastWordEnd; + if (lastWordEnd != text.start) { + *continueFrom_out = lastWordEnd; + } + else { + *continueFrom_out = currentPos; /* forced break */ + } break; } const SDL_Rect dst = { x1 + glyph->d[hoff].x, -- cgit v1.2.3