From d75ad4213c81e588358aee4786ad13ca08c80d0c Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 27 Mar 2021 11:19:37 +0200 Subject: Text: Further word wrap fixes Set the correct break position in noWrap mode. --- src/ui/text.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ui/text.c b/src/ui/text.c index 1af7bb5d..80d3634c 100644 --- a/src/ui/text.c +++ b/src/ui/text.c @@ -800,7 +800,7 @@ static enum iFontId fontId_Text_(const iFont *font) { iLocalDef iBool isWrapPunct_(iChar c) { /* Punctuation that participates in word-wrapping. */ - return (c == '/' || c == '=' || c == '-' || c == ',' || c == ';' || c == '.' || c == ':' || c == 0xad); + return (c == '/' || c == '\\' || c == '=' || c == '-' || c == ',' || c == ';' || c == '.' || c == ':' || c == 0xad); } iLocalDef iBool isClosingBracket_(iChar c) { @@ -825,7 +825,8 @@ iLocalDef iBool isWrapBoundary_(iChar prevC, iChar c) { if (isSpace_Char(prevC)) { return iFalse; } - if ((prevC == '/' || prevC == '-' || prevC == '_' || prevC == '+') && !isWrapPunct_(c)) { + if ((prevC == '/' || prevC == '\\' || prevC == '-' || prevC == '_' || prevC == '+') && + !isWrapPunct_(c)) { return iTrue; } return isSpace_Char(c); @@ -991,7 +992,7 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { /* Out of the allotted space on the line? */ if (args->xposLimit > 0 && x2 > args->xposLimit) { if (args->continueFrom_out) { - if (lastWordEnd != args->text.start) { + if (lastWordEnd != args->text.start && ~mode & noWrapFlag_RunMode) { *args->continueFrom_out = lastWordEnd; } else { @@ -1064,7 +1065,7 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { xposExtend = iMax(xposExtend, xpos); xposMax = iMax(xposMax, xposExtend); if (args->continueFrom_out && ((mode & noWrapFlag_RunMode) || isWrapBoundary_(prevCh, ch))) { - lastWordEnd = currentPos; + lastWordEnd = currentPos; /* mark word wrap position */ } #if defined (LAGRANGE_ENABLE_KERNING) /* Check the next character. */ -- cgit v1.2.3