From f643e1f687e27e7f46c53d7298772d4dddb3e660 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Sun, 12 Nov 2017 18:46:48 +0100 Subject: Upgrade to ICU 60.1 Change-Id: I07837be7faac0b2238b0cba8fb981e4c4d24c498 --- .../source/breakiterator/breakiterator_unicode.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'i18npool') 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 -- cgit