diff options
| -rw-r--r-- | cocoa/ScintillaCocoa.mm | 13 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 13 | 
2 files changed, 25 insertions, 1 deletions
| diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index ec78479b9..8d061205a 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -2284,7 +2284,18 @@ ptrdiff_t ScintillaCocoa::InsertText(NSString *input) {    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 sv = encoded; +      while (sv.length()) { +        const unsigned char leadByte = sv[0]; +        const unsigned int bytesInCharacter = UTF8BytesOfLead[leadByte]; +        AddCharUTF(sv.c_str(), bytesInCharacter, false); +        sv = sv.substr(bytesInCharacter, sv.length()); +      } +    } 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 6d67c2f13..8b6a1d43c 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -547,6 +547,19 @@  	Released 31 October 2018.  	</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> +    </ul> +	<h3> +       <a href="https://sourceforge.net/projects/scintilla/files/scintilla/3.10.1/scintilla3101.zip/download">Release 3.10.1</a> +    </h3> +    <ul> +	<li> +	Released 31 October 2018. +	</li> +	<li>  	Add SCI_SETCOMMANDEVENTS API to allow turning off command events as they  	can be a significant performance cost.  	</li> | 
