The change applied to stop memory allocation errors with Chinese input caused the accented character chooser used with European languages to not appear. This is the small window that appears when you hold down a key showing potential accented forms: hold down “o" and a choice from "ôöòóœøōõ” is shown.
To fix this, the previous change (returning NSNotFound when the selection is empty) was made conditional so that it only happens with the "Cangjie" input source. This is ugly but I haven’t found a better solution. If other input sources show similar errors then they should be reported so the condition can be expanded.
Some other selection actions may cause messages or breaks inside the Xcode debugger but should be OK when running a release build.
Change set:
https://sourceforge.net/p/scintilla/code/ci/29534cb8eafb48f9eacc574b8063e9d66520ae8a/
Also made a change that substitutes the replacement character (0xFFFD) for any invalid UTF-8 when reporting text to the IME as invalid Unicode also upsets the systems IME code:
https://sourceforge.net/p/scintilla/code/ci/b82fe8d33961050a7905d6588eef858b85ca804c/
Neil