aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2025-02-14 12:24:58 +1100
committerNeil <nyamatongwe@gmail.com>2025-02-14 12:24:58 +1100
commit0526a5ca6efb68152f88d9a258ef957b808cd831 (patch)
treecfbda11590308dd95a05844ff059a1d683038992
parent10e12f5d8d45ce1dadc97a09c11f9e0f340a79d3 (diff)
downloadscintilla-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
-rw-r--r--doc/ScintillaHistory.html1
-rw-r--r--src/PositionCache.cxx7
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;