summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-25 19:40:41 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-25 19:40:41 +0200
commitf1f614c0c394df314c5741c4e1d0f88ada22bdc4 (patch)
tree45f44c720ae8abe19f9681fefb7ea2ca962c7ecd /src
parent2abb8ca76b4b99599bddbd57d434a4c9e99038e3 (diff)
Text: Improved word wrapping
This was complicated by the wrap position being placed one character later than intended. IssueID #201
Diffstat (limited to 'src')
-rw-r--r--src/ui/text.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index c4ad8172..ac879af4 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -845,9 +845,9 @@ iLocalDef iBool isClosingBracket_(iChar c) {
845 return (c == ')' || c == ']' || c == '}' || c == '>'); 845 return (c == ')' || c == ']' || c == '}' || c == '>');
846} 846}
847 847
848iLocalDef iBool isBracket_(iChar c) { 848//iLocalDef iBool isBracket_(iChar c) {
849 return (c == '(' || c == '[' || c == '{' || c == '<' || isClosingBracket_(c)); 849// return (c == '(' || c == '[' || c == '{' || c == '<' || isClosingBracket_(c));
850} 850//}
851 851
852iLocalDef iBool isWrapBoundary_(iChar prevC, iChar c) { 852iLocalDef iBool isWrapBoundary_(iChar prevC, iChar c) {
853 /* Line wrapping boundaries are determined by looking at a character and the 853 /* Line wrapping boundaries are determined by looking at a character and the
@@ -857,13 +857,13 @@ iLocalDef iBool isWrapBoundary_(iChar prevC, iChar c) {
857 can wrap text like foo/bar/baz-abc-def.xyz at any puncation boundaries, 857 can wrap text like foo/bar/baz-abc-def.xyz at any puncation boundaries,
858 without wrapping on other punctuation used for expressive purposes like 858 without wrapping on other punctuation used for expressive purposes like
859 emoticons :-) */ 859 emoticons :-) */
860 if (isClosingBracket_(c)) { 860 if (isClosingBracket_(prevC) && !isWrapPunct_(c)) {
861 return iTrue; 861 return iTrue;
862 } 862 }
863 if (isSpace_Char(prevC)) { 863 if (isSpace_Char(prevC)) {
864 return iFalse; 864 return iFalse;
865 } 865 }
866 if ((c == '/' || c == '-' || c == '_' || c == '+') && !isWrapPunct_(prevC)) { 866 if ((prevC == '/' || prevC == '-' || prevC == '_' || prevC == '+') && !isWrapPunct_(c)) {
867 return iTrue; 867 return iTrue;
868 } 868 }
869 return isSpace_Char(c); 869 return isSpace_Char(c);
@@ -1102,7 +1102,7 @@ static iRect run_Font_(iFont *d, const iRunArgs *args) {
1102 xposExtend = iMax(xposExtend, xpos); 1102 xposExtend = iMax(xposExtend, xpos);
1103 xposMax = iMax(xposMax, xposExtend); 1103 xposMax = iMax(xposMax, xposExtend);
1104 if (args->continueFrom_out && ((mode & noWrapFlag_RunMode) || isWrapBoundary_(prevCh, ch))) { 1104 if (args->continueFrom_out && ((mode & noWrapFlag_RunMode) || isWrapBoundary_(prevCh, ch))) {
1105 lastWordEnd = chPos; 1105 lastWordEnd = currentPos;
1106 } 1106 }
1107#if defined (LAGRANGE_ENABLE_KERNING) 1107#if defined (LAGRANGE_ENABLE_KERNING)
1108 /* Check the next character. */ 1108 /* Check the next character. */