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);
+ if (SCHARS (inev.arg))
+ Fput_text_property (make_fixnum (min (SCHARS (inev.arg) - 1,
+ max (0, cursor))),
+ make_fixnum (min (SCHARS (inev.arg),
+ max (0, cursor) + 1)),
+ Qcursor, Qt, inev.arg);
kbd_buffer_store_event (&inev);
ie.arg = make_string_from_utf8 (output->preedit_chars,
output->preedit_size);
- 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);
+ if (SCHARS (ie.arg))
+ Fput_text_property (make_fixnum (min (SCHARS (ie.arg) - 1,
+ max (0, output->preedit_caret))),
+ make_fixnum (max (SCHARS (ie.arg),
+ max (0, output->preedit_caret) + 1)),
+ Qcursor, Qt, ie.arg);
XSETINT (ie.x, 0);
XSETINT (ie.y, 0);
ie.arg = make_string_from_utf8 (output->preedit_chars,
output->preedit_size);
- 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);
+ if (SCHARS (ie.arg))
+ Fput_text_property (make_fixnum (min (SCHARS (ie.arg) - 1,
+ max (0, output->preedit_caret))),
+ make_fixnum (min (SCHARS (ie.arg),
+ max (0, output->preedit_caret) + 1)),
+ Qcursor, Qt, ie.arg);
XSETINT (ie.x, 0);
XSETINT (ie.y, 0);