diff options
author | Neil <nyamatongwe@gmail.com> | 2025-02-14 12:24:58 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-02-14 12:24:58 +1100 |
commit | 0526a5ca6efb68152f88d9a258ef957b808cd831 (patch) | |
tree | cfbda11590308dd95a05844ff059a1d683038992 /src/PositionCache.cxx | |
parent | 10e12f5d8d45ce1dadc97a09c11f9e0f340a79d3 (diff) | |
download | scintilla-mirror-0526a5ca6efb68152f88d9a258ef957b808cd831.tar.gz |
For wrapping, try to break lines without separating letters from modifiers.
There are still problems for languages like Javanese but it will improve most
cases.
Unicode proposal to improve line breaking:
https://www.unicode.org/L2/L2022/22080r2-line-break-ortho-bnd.pdf
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r-- | src/PositionCache.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
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; |