From e15a9f49e1c9224d1c81bc5ef1c14f008ee2d87c Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 2 Mar 2017 09:08:04 +1100 Subject: Bug [#1881]. Revert part of previous fix as it stopped the accented character chooser from appearing. Special-case the Chinese "Cangjie" input source. --- cocoa/ScintillaView.mm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'cocoa') diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index fb299d947..107c421c3 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -569,7 +569,17 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) const NSRange posRangeSel = [mOwner selectedRangePositions]; if (posRangeSel.length == 0) { - return NSMakeRange(NSNotFound, 0); + NSTextInputContext *tic = [NSTextInputContext currentInputContext]; + // Chinese input causes malloc crash when empty selection returned with actual + // position so return NSNotFound. + // If this is applied to European input, it stops the accented character + // chooser from appearing. + // May need to add more input source names. + if ([tic.selectedKeyboardInputSource + isEqualToString:@"com.apple.inputmethod.TCIM.Cangjie"]) + { + return NSMakeRange(NSNotFound, 0); + } } return mOwner.backend->CharactersFromPositions(posRangeSel); } -- cgit v1.2.3