summaryrefslogtreecommitdiffstats
path: root/src/PinyinEngine.cc
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2009-10-02 08:21:09 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2009-10-02 08:21:09 +0800
commit5af19efc0e13f928769ee7255ef5ed1b840b2d9a (patch)
treed3a821241c3d6fd48c322ad0177eb1419a1d7b57 /src/PinyinEngine.cc
parent60cfd20aa525f1245565f45801ea2a678f147f62 (diff)
downloadibus-libpinyin-5af19efc0e13f928769ee7255ef5ed1b840b2d9a.tar.gz
ibus-libpinyin-5af19efc0e13f928769ee7255ef5ed1b840b2d9a.tar.xz
ibus-libpinyin-5af19efc0e13f928769ee7255ef5ed1b840b2d9a.zip
Fix auto commit problem.
Diffstat (limited to 'src/PinyinEngine.cc')
-rw-r--r--src/PinyinEngine.cc27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/PinyinEngine.cc b/src/PinyinEngine.cc
index 9a135c4..2d1e5fc 100644
--- a/src/PinyinEngine.cc
+++ b/src/PinyinEngine.cc
@@ -192,7 +192,7 @@ PinyinEngine::processSpace (guint keyval, guint keycode, guint modifiers)
if (CMSHM_FILTER (modifiers) != 0)
return FALSE;
- if (G_UNLIKELY (keyval == IBUS_space && (modifiers & IBUS_SHIFT_MASK))) {
+ if (G_UNLIKELY (modifiers & IBUS_SHIFT_MASK)) {
toggleModeFull ();
return TRUE;
}
@@ -275,6 +275,10 @@ PinyinEngine::processPunct (guint keyval, guint keycode, guint modifiers)
if (G_LIKELY (!Config::autoCommit ()))
return TRUE;
+
+ if (m_phrase_editor.pinyinExistsAfterCursor ()) {
+ selectCandidate (m_lookup_table.cursorPos ());
+ }
commit ();
}
@@ -379,24 +383,7 @@ PinyinEngine::processOthers (guint keyval, guint keycode, guint modifiers)
case IBUS_Return:
case IBUS_KP_Enter:
- m_buffer.truncate (0);
- if (G_LIKELY (m_mode_simp))
- m_buffer << m_phrase_editor.selectedString ();
- else
- SimpTradConverter::simpToTrad (m_phrase_editor.selectedString (), m_buffer);
- if (G_UNLIKELY (m_mode_full)) {
- const gchar *p = m_pinyin_editor->textAfterPinyin (m_buffer.utf8Length ());
- for (; *p != 0; p++) {
- m_buffer.appendUnichar (HalfFullConverter::toFull (*p));
- }
- commit (m_buffer);
- }
- else {
- m_buffer << m_pinyin_editor->textAfterPinyin (m_buffer.utf8Length ());
- commit (m_buffer);
- }
- m_pinyin_editor->reset ();
- _update = TRUE;
+ commit ();
break;
case IBUS_BackSpace:
@@ -936,7 +923,7 @@ PinyinEngine::commit (void)
SimpTradConverter::simpToTrad (m_phrase_editor.selectedString (), m_buffer);
}
- const gchar *p = m_pinyin_editor->textAfterPinyin ();
+ const gchar *p = m_pinyin_editor->textAfterPinyin (m_buffer.utf8Length ());
if (G_UNLIKELY (m_mode_full)) {
while (*p != '\0') {
m_buffer.appendUnichar (HalfFullConverter::toFull (*p++));