diff options
author | Peng Wu <pwu@redhat.com> | 2019-11-29 13:23:16 +0800 |
---|---|---|
committer | Peng Wu <pwu@redhat.com> | 2019-11-29 13:23:16 +0800 |
commit | 17121ad1dbc8c9be44d449c2d79179cdd90f6d7c (patch) | |
tree | 3ce21d66cc84c7504266ef765ddb77250ee5db2b | |
parent | 592b628000d9b58bb714ff9232d7d2ddf814cacf (diff) | |
download | ibus-libpinyin-17121ad1dbc8c9be44d449c2d79179cdd90f6d7c.tar.gz ibus-libpinyin-17121ad1dbc8c9be44d449c2d79179cdd90f6d7c.tar.xz ibus-libpinyin-17121ad1dbc8c9be44d449c2d79179cdd90f6d7c.zip |
fixes comma handling
-rw-r--r-- | src/PYFallbackEditor.cc | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/PYFallbackEditor.cc b/src/PYFallbackEditor.cc index 3d03b49..6020591 100644 --- a/src/PYFallbackEditor.cc +++ b/src/PYFallbackEditor.cc @@ -76,13 +76,21 @@ FallbackEditor::processPunctForSimplifiedChinese (guint keyval, guint keycode, g m_double_quote = !m_double_quote; return TRUE; case ',': - commit (","); return TRUE; + if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') { + m_prev_committed_char = keyval; + return FALSE; + } else { + commit (","); + return TRUE; + } case '.': - if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') + if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') { + m_prev_committed_char = keyval; return FALSE; - else + } else { commit ("。"); - return TRUE; + return TRUE; + } case '<': commit ("《"); return TRUE; case '>': @@ -144,13 +152,21 @@ FallbackEditor::processPunctForTraditionalChinese (guint keyval, guint keycode, m_double_quote = !m_double_quote; return TRUE; case ',': - commit (","); return TRUE; + if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') { + m_prev_committed_char = keyval; + return FALSE; + } else { + commit (","); + return TRUE; + } case '.': - if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') + if (m_prev_committed_char >= '0' && m_prev_committed_char <= '9') { + m_prev_committed_char = keyval; return FALSE; - else + } else { commit ("。"); - return TRUE; + return TRUE; + } case '<': commit ("《"); return TRUE; case '>': |