aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cocoa/PlatCocoa.mm5
-rw-r--r--doc/ScintillaHistory.html9
2 files changed, 13 insertions, 1 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 4789f7528..a74c805a4 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -164,13 +164,15 @@ public:
ScreenLineLayout::ScreenLineLayout(const IScreenLine *screenLine) : text(screenLine->Text()) {
const UInt8 *puiBuffer = reinterpret_cast<const UInt8 *>(text.data());
+ std::string_view sv = text;
// Start with an empty mutable attributed string and add each character to it.
CFMutableAttributedStringRef mas = CFAttributedStringCreateMutable(NULL, 0);
for (size_t bp=0; bp<text.length();) {
const unsigned char uch = text[bp];
- const unsigned int byteCount = UTF8BytesOfLead[uch];
+ const int utf8Status = UTF8Classify(sv);
+ const unsigned int byteCount = utf8Status & UTF8MaskWidth;
XYPOSITION repWidth = screenLine->RepresentationWidth(bp);
if (uch == '\t') {
// Find the size up to the tab
@@ -207,6 +209,7 @@ ScreenLineLayout::ScreenLineLayout(const IScreenLine *screenLine) : text(screenL
CFRangeMake(CFAttributedStringGetLength(mas), 0),
as);
bp += byteCount;
+ sv.remove_prefix(byteCount);
CFRelease(as);
}
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index 236dbb107..5d4e6344d 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -548,6 +548,15 @@
</li>
</ul>
<h3>
+ <a href="https://www.scintilla.org/scite413.zip">Release 4.1.3</a>
+ </h3>
+ <ul>
+ <li>
+ Fixed a crash on Cocoa in bidirectional mode where some patterns of invalid UTF-8
+ caused failures to create Unicode strings.
+ </li>
+ </ul>
+ <h3>
<a href="https://www.scintilla.org/scite412.zip">Release 4.1.2</a>
</h3>
<ul>