EVENT_INIT (inev);
inev.kind = PREEDIT_TEXT_EVENT;
inev.arg = build_string_from_utf8 (str);
+
+ Fput_text_property (make_fixnum (min (SCHARS (inev.arg),
+ max (0, cursor))),
+ make_fixnum (min (SCHARS (inev.arg),
+ max (0, cursor) + 1)),
+ Qcursor, Qt, inev.arg);
+
kbd_buffer_store_event (&inev);
g_free (str);
inev.ie.modifiers
|= x_x_to_emacs_modifiers (FRAME_DISPLAY_INFO (f), xstate);
+ if (event->key.is_modifier)
+ goto done;
+
/* First deal with keysyms which have defined
translations to characters. */
if (keysym >= 32 && keysym < 128)
|| IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */
|| IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */
/* Any "vendor-specific" key is ok. */
- || (keysym & (1 << 28)))
- && !(event->key.is_modifier))
+ || (keysym & (1 << 28))))
{
inev.ie.kind = NON_ASCII_KEYSTROKE_EVENT;
inev.ie.code = keysym;
ie.arg = make_string_from_utf8 (output->preedit_chars,
output->preedit_size);
- Fput_text_property (make_fixnum (max (0, output->preedit_caret)),
+ Fput_text_property (make_fixnum (min (SCHARS (ie.arg),
+ max (0, output->preedit_caret))),
make_fixnum (max (SCHARS (ie.arg),
max (0, output->preedit_caret) + 1)),
Qcursor, Qt, ie.arg);
ie.arg = make_string_from_utf8 (output->preedit_chars,
output->preedit_size);
- Fput_text_property (make_fixnum (max (0, output->preedit_caret)),
+ Fput_text_property (make_fixnum (min (SCHARS (ie.arg),
+ max (0, output->preedit_caret))),
make_fixnum (min (SCHARS (ie.arg),
max (0, output->preedit_caret) + 1)),
Qcursor, Qt, ie.arg);