888 // insertText gets called when the user commits text generated from an input method. It also gets |
888 // insertText gets called when the user commits text generated from an input method. It also gets |
889 // called during ordinary input as well. We only need to send an input method event when we have marked |
889 // called during ordinary input as well. We only need to send an input method event when we have marked |
890 // text, or 'text in progress'. We also need to send the event if we get an insert text out of the blue! |
890 // text, or 'text in progress'. We also need to send the event if we get an insert text out of the blue! |
891 // (i.e., when the user uses the Character palette or Inkwell), or when the string to insert is a complex |
891 // (i.e., when the user uses the Character palette or Inkwell), or when the string to insert is a complex |
892 // Unicode value. |
892 // Unicode value. |
893 NSUInteger utf8Length = [aString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; |
893 NSUInteger utf16Length = [aString lengthOfBytesUsingEncoding:NSUTF16StringEncoding]; |
894 |
894 |
895 if ([self hasMarkedText] || !fProcessingKeystroke || (utf8Length > 1)) { |
895 if ([self hasMarkedText] || !fProcessingKeystroke || (utf16Length > 2)) { |
896 JNIEnv *env = [ThreadUtilities getJNIEnv]; |
896 JNIEnv *env = [ThreadUtilities getJNIEnv]; |
897 |
897 |
898 static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V"); |
898 static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V"); |
899 // We need to select the previous glyph so that it is overwritten. |
899 // We need to select the previous glyph so that it is overwritten. |
900 if (fPAHNeedsToSelect) { |
900 if (fPAHNeedsToSelect) { |