diff options
author | David Tardon <dtardon@redhat.com> | 2017-11-12 18:46:48 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-11-17 00:17:04 +0100 |
commit | f643e1f687e27e7f46c53d7298772d4dddb3e660 (patch) | |
tree | 77cebb05db0f987d63b2363e95b5afefc9dec88e /i18npool/source/breakiterator | |
parent | 26ea47b7217053efb5eaa20f76b8895d29ae1f18 (diff) |
Upgrade to ICU 60.1
Change-Id: I07837be7faac0b2238b0cba8fb981e4c4d24c498
Diffstat (limited to 'i18npool/source/breakiterator')
-rw-r--r-- | i18npool/source/breakiterator/breakiterator_unicode.cxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index bd9d09a34afc..b4ca111179c1 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -544,6 +544,27 @@ LineBreakResults SAL_CALL BreakIterator_Unicode::getLineBreak( } else { //word boundary break lbr.breakIndex = pLineBI->preceding(nStartPos); lbr.breakType = BreakType::WORDBOUNDARY; + + // Special case for Slash U+002F SOLIDUS in URI and path names. + // TR14 defines that as SY: Symbols Allowing Break After (A). + // This is unwanted in paths, see also i#17155 + if (lbr.breakIndex > 0 && Text[lbr.breakIndex-1] == '/') + { + // Look backward and take any whitespace before as a break + // opportunity. This also glues something like "w/o". + // Avoid an overly long path and break it as was indicated. + // Overly long here is arbitrarily defined. + const sal_Int32 nOverlyLong = 66; + sal_Int32 nPos = lbr.breakIndex - 1; + while (nPos > 0 && lbr.breakIndex - nPos < nOverlyLong) + { + if (u_isWhitespace(Text.iterateCodePoints( &nPos, -1))) + { + lbr.breakIndex = nPos + 1; + break; + } + } + } } #define WJ 0x2060 // Word Joiner |