diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-27 11:19:37 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-03-27 11:19:37 +0200 |
commit | d75ad4213c81e588358aee4786ad13ca08c80d0c (patch) | |
tree | 65979af4ab109e809f5b7271871b2e6fc25978ce /src/ui/text.c | |
parent | 62d4496931cf17b240022ffcf48bf27e27c5e605 (diff) |
Text: Further word wrap fixes
Set the correct break position in noWrap mode.
Diffstat (limited to 'src/ui/text.c')
-rw-r--r-- | src/ui/text.c | 9 |
1 files changed, 5 insertions, 4 deletions
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) { | |||
800 | 800 | ||
801 | iLocalDef iBool isWrapPunct_(iChar c) { | 801 | iLocalDef iBool isWrapPunct_(iChar c) { |
802 | /* Punctuation that participates in word-wrapping. */ | 802 | /* Punctuation that participates in word-wrapping. */ |
803 | return (c == '/' || c == '=' || c == '-' || c == ',' || c == ';' || c == '.' || c == ':' || c == 0xad); | 803 | return (c == '/' || c == '\\' || c == '=' || c == '-' || c == ',' || c == ';' || c == '.' || c == ':' || c == 0xad); |
804 | } | 804 | } |
805 | 805 | ||
806 | iLocalDef iBool isClosingBracket_(iChar c) { | 806 | iLocalDef iBool isClosingBracket_(iChar c) { |
@@ -825,7 +825,8 @@ iLocalDef iBool isWrapBoundary_(iChar prevC, iChar c) { | |||
825 | if (isSpace_Char(prevC)) { | 825 | if (isSpace_Char(prevC)) { |
826 | return iFalse; | 826 | return iFalse; |
827 | } | 827 | } |
828 | if ((prevC == '/' || prevC == '-' || prevC == '_' || prevC == '+') && !isWrapPunct_(c)) { | 828 | if ((prevC == '/' || prevC == '\\' || prevC == '-' || prevC == '_' || prevC == '+') && |
829 | !isWrapPunct_(c)) { | ||
829 | return iTrue; | 830 | return iTrue; |
830 | } | 831 | } |
831 | return isSpace_Char(c); | 832 | return isSpace_Char(c); |
@@ -991,7 +992,7 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
991 | /* Out of the allotted space on the line? */ | 992 | /* Out of the allotted space on the line? */ |
992 | if (args->xposLimit > 0 && x2 > args->xposLimit) { | 993 | if (args->xposLimit > 0 && x2 > args->xposLimit) { |
993 | if (args->continueFrom_out) { | 994 | if (args->continueFrom_out) { |
994 | if (lastWordEnd != args->text.start) { | 995 | if (lastWordEnd != args->text.start && ~mode & noWrapFlag_RunMode) { |
995 | *args->continueFrom_out = lastWordEnd; | 996 | *args->continueFrom_out = lastWordEnd; |
996 | } | 997 | } |
997 | else { | 998 | else { |
@@ -1064,7 +1065,7 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) { | |||
1064 | xposExtend = iMax(xposExtend, xpos); | 1065 | xposExtend = iMax(xposExtend, xpos); |
1065 | xposMax = iMax(xposMax, xposExtend); | 1066 | xposMax = iMax(xposMax, xposExtend); |
1066 | if (args->continueFrom_out && ((mode & noWrapFlag_RunMode) || isWrapBoundary_(prevCh, ch))) { | 1067 | if (args->continueFrom_out && ((mode & noWrapFlag_RunMode) || isWrapBoundary_(prevCh, ch))) { |
1067 | lastWordEnd = currentPos; | 1068 | lastWordEnd = currentPos; /* mark word wrap position */ |
1068 | } | 1069 | } |
1069 | #if defined (LAGRANGE_ENABLE_KERNING) | 1070 | #if defined (LAGRANGE_ENABLE_KERNING) |
1070 | /* Check the next character. */ | 1071 | /* Check the next character. */ |