Commit string if use press common key in convert mode.

This commit is contained in:
Huang Peng 2008-06-12 15:11:12 +08:00
Родитель acea89868a
Коммит c12e561975
2 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -134,7 +134,7 @@ class Engine (interface.IEngine):
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
@ -323,7 +323,10 @@ class Engine (interface.IEngine):
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 ()

Просмотреть файл

@ -11,10 +11,13 @@ class PangoAttrList (pango.AttrList):
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)