def _commit_string (self, text):
self._reset ()
self.CommitString (text)
- self._update ()
+ self._invalidate ()
def _update_input_chars (self):
begin, end = max (self._cursor_pos - 4, 0), self._cursor_pos
def _on_key_common (self, keyval):
if self._convert_begined:
- return True
+ i = 0
+ for seg_index, text in self._segments:
+ self._context.commit_segment (i, seg_index)
+ self._commit_string (self._convert_chars)
self._input_chars += unichr (keyval)
self._cursor_pos += 1
self._invalidate ()
for c in unistr:
offsets.append (offset)
offset += len (c.encode ("utf8"))
+ offsets.append (offset)
for attr in attrs:
pango_attr = None
- start_index = offsets[attr._start_index]
- end_index = offsets[attr._end_index]
+ start_index = attrs._start_index if attrs._start_index >= 0 else 0
+ end_index = attrs._end_index if attrs._end_index >= 0 else 0
+ start_index = offsets[_start_index] if attrstart_index < len (offsets) else offsets[-1]
+ end_index = offsets[_end_index] if end_index < len (offsets) else offsets[-1]
if attr._type == ibus.ATTR_TYPE_FOREGROUND:
r = (attr._value & 0x00ff0000) >> 8
g = (attr._value & 0x0000ff00)