diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/text.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/ui/text.c b/src/ui/text.c index 8107b886..c4ad8172 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -836,6 +836,19 @@ static enum iFontId fontId_Text_(const iFont *font) { | |||
836 | return (enum iFontId) (font - text_.fonts); | 836 | return (enum iFontId) (font - text_.fonts); |
837 | } | 837 | } |
838 | 838 | ||
839 | iLocalDef iBool isWrapPunct_(iChar c) { | ||
840 | /* Punctuation that participates in word-wrapping. */ | ||
841 | return (c == '/' || c == '=' || c == '-' || c == ',' || c == ';' || c == '.' || c == ':' || c == 0xad); | ||
842 | } | ||
843 | |||
844 | iLocalDef iBool isClosingBracket_(iChar c) { | ||
845 | return (c == ')' || c == ']' || c == '}' || c == '>'); | ||
846 | } | ||
847 | |||
848 | iLocalDef iBool isBracket_(iChar c) { | ||
849 | return (c == '(' || c == '[' || c == '{' || c == '<' || isClosingBracket_(c)); | ||
850 | } | ||
851 | |||
839 | iLocalDef iBool isWrapBoundary_(iChar prevC, iChar c) { | 852 | iLocalDef iBool isWrapBoundary_(iChar prevC, iChar c) { |
840 | /* 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 |
841 | last character processed. We want to wrap at natural word boundaries where | 854 | last character processed. We want to wrap at natural word boundaries where |
@@ -844,14 +857,13 @@ iLocalDef iBool isWrapBoundary_(iChar prevC, iChar c) { | |||
844 | 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, |
845 | without wrapping on other punctuation used for expressive purposes like | 858 | without wrapping on other punctuation used for expressive purposes like |
846 | emoticons :-) */ | 859 | emoticons :-) */ |
847 | if (c == '.' && (prevC == '(' || prevC == '[' || prevC == '.')) { | 860 | if (isClosingBracket_(c)) { |
848 | /* Start of a [...], perhaps? */ | 861 | return iTrue; |
849 | return iFalse; | ||
850 | } | 862 | } |
851 | if (isSpace_Char(prevC)) { | 863 | if (isSpace_Char(prevC)) { |
852 | return iFalse; | 864 | return iFalse; |
853 | } | 865 | } |
854 | if (c == '/' || c == '-' || c == ',' || c == ';' || c == ':' || c == '.' || c == 0xad) { | 866 | if ((c == '/' || c == '-' || c == '_' || c == '+') && !isWrapPunct_(prevC)) { |
855 | return iTrue; | 867 | return iTrue; |
856 | } | 868 | } |
857 | return isSpace_Char(c); | 869 | return isSpace_Char(c); |