diff options
-rw-r--r-- | doc/ScintillaHistory.html | 1 | ||||
-rw-r--r-- | src/PositionCache.cxx | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index c9f423488..8e50097a4 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -612,6 +612,7 @@ </li> <li> Fix segmentation of long lexemes to avoid breaking before modifiers like accents that must be drawn with their base letters. + For wrapping, try to break lines without separating letters from modifiers. </li> <li> For GTK on Windows, replace reverse arrow cursor with hand as reverse arrow was small in scaled modes. diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 5cc8f8fe8..07f0c9541 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -355,6 +355,13 @@ void LineLayout::WrapLine(const Document *pdoc, Sci::Position posLineStart, Wrap Sci::Position lastGoodBreak = p; if (p > 0) { lastGoodBreak = CharacterBoundary(p, -1); + if (CpUtf8 == pdoc->dbcsCodePage) { + // Go back before a base character, commonly a letter as modifiers are after the letter they modify + std::string_view svWithoutLast(&chars[lastLineStart], CharacterBoundary(p+1, 1) - lastLineStart); + if (DiscardLastCombinedCharacter(svWithoutLast) && !svWithoutLast.empty()) { + lastGoodBreak = lastLineStart + static_cast<Sci::Position>(svWithoutLast.length()); + } + } } if (wrapState != Wrap::Char) { Sci::Position pos = lastGoodBreak; |