void HandleCommit (object o, CommitArgs args)
		{
			RemoveSelection ();
			CurrentEntry = CurrentEntry.Insert (CaretOffset, args.Str);
			CaretOffset += args.Str.Length;
			QueueDraw ();
		}
示例#2
0
        private void OnIMCommit(object o, CommitArgs args)
        {
            try {
                var str = new StringBuilder ();

                for (int i = 0; i < args.Str.Length; i++) {
                    char utf32Char;
                    if (char.IsHighSurrogate (args.Str, i)) {
                        utf32Char = (char)char.ConvertToUtf32 (args.Str, i);
                        i++;
                    } else {
                        utf32Char = args.Str[i];
                    }

                    str.Append (utf32Char.ToString ());
                }

                CurrentTextEngine.InsertText (str.ToString ());
            } finally {
                imContext.Reset ();
            }
        }