diff options
| -rw-r--r-- | cocoa/ScintillaCocoa.mm | 13 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 5 | 
2 files changed, 17 insertions, 1 deletions
| diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 1338a66fa..9a7125023 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -2179,7 +2179,18 @@ ptrdiff_t ScintillaCocoa::InsertText(NSString *input) {  	std::string encoded = EncodedBytesString((__bridge CFStringRef)input, encoding);  	if (encoded.length() > 0) { -		AddCharUTF(encoded.c_str(), static_cast<unsigned int>(encoded.length()), false); +		if (encoding == kCFStringEncodingUTF8) { +			// There may be multiple characters in input so loop over them +			std::string_view sv = encoded; +			while (sv.length()) { +				const unsigned char leadByte = sv[0]; +				const unsigned int bytesInCharacter = UTF8BytesOfLead[leadByte]; +				AddCharUTF(sv.data(), bytesInCharacter, false); +				sv.remove_prefix(bytesInCharacter); +			} +		} else { +			AddCharUTF(encoded.c_str(), static_cast<unsigned int>(encoded.length()), false); +		}  	}  	return encoded.length();  } diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 9f2129154..55b23216a 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -564,6 +564,11 @@  	Updated case conversion and character categories to Unicode 11.  	</li>  	<li> +	On Cocoa, fix a crash that occurred when entering a dead key diacritic then a character +	that can not take that diacritic, such as option+e (acute accent) followed by g. +	<a href="https://sourceforge.net/p/scintilla/bugs/2061/">Bug #2061</a>. +	</li> +	<li>  	On Cocoa, use dark info bar background when system is set to Dark Appearance.  	<a href="https://sourceforge.net/p/scintilla/bugs/2055/">Bug #2055</a>.  	</li> | 
