diff options
author | Peng Wu <alexepico@gmail.com> | 2018-10-15 16:33:36 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2018-10-15 16:33:36 +0800 |
commit | 4d768fd5f8cb47eca8ad03f45bde9b4acba7da4c (patch) | |
tree | 3921c3f181316f9d5c833d44b29b113bed263932 /src/ZYZZhuyinEditor.cc | |
parent | 8149d9d308c4af3e4ec2b3598e58a5859f7156e5 (diff) | |
download | ibus-libzhuyin-4d768fd5f8cb47eca8ad03f45bde9b4acba7da4c.tar.gz ibus-libzhuyin-4d768fd5f8cb47eca8ad03f45bde9b4acba7da4c.tar.xz ibus-libzhuyin-4d768fd5f8cb47eca8ad03f45bde9b4acba7da4c.zip |
fixes processSpace method
Diffstat (limited to 'src/ZYZZhuyinEditor.cc')
-rw-r--r-- | src/ZYZZhuyinEditor.cc | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/ZYZZhuyinEditor.cc b/src/ZYZZhuyinEditor.cc index d8e7b84..2c1ce9e 100644 --- a/src/ZYZZhuyinEditor.cc +++ b/src/ZYZZhuyinEditor.cc @@ -242,31 +242,38 @@ ZhuyinEditor::processSpace (guint keyval, guint keycode, guint modifiers) if (cmshm_filter (modifiers) != 0) return FALSE; - /* use space to show candidates. */ - if (m_config.spaceShowCandidates ()) { - size_t index = 0; - size_t start_pos = 0, end_pos = 0; + size_t index = 0; + size_t start_pos = 0, end_pos = 0; - /* detect whether the space key is part of zhuyin input. */ - insert_phonetic (new_text, m_cursor, ' '); + /* detect whether the space key is part of zhuyin input. */ + insert_phonetic (new_text, m_cursor, ' '); - probe_section_start (new_text, m_cursor, - cursor, index, start_pos); + probe_section_start (new_text, m_cursor, + cursor, index, start_pos); - section_t type = probe_section_quick (new_text, start_pos); + section_t type = probe_section_quick (new_text, start_pos); + + if (PHONETIC_SECTION == type) { + String section; + get_phonetic_section (new_text, start_pos, end_pos, section); - if (PHONETIC_SECTION == type) { - String section; - get_phonetic_section (new_text, start_pos, end_pos, section); + zhuyin_parse_more_chewings (m_instance, section.c_str ()); + size_t parsed_len = zhuyin_get_parsed_input_length (m_instance); - zhuyin_parse_more_chewings (m_instance, section.c_str ()); - size_t parsed_len = zhuyin_get_parsed_input_length (m_instance); + /* part of the zhuyin string. */ + if (cursor < parsed_len) { + return insert (keyval, keycode, modifiers); + } else if (!m_config.spaceShowCandidates ()) { + insertSymbol (keyval); - /* part of the zhuyin string. */ - if (cursor < parsed_len) - return insert (keyval, keycode, modifiers); + updateZhuyin (); + update (); + return TRUE; } + } + /* use space to show candidates. */ + if (m_config.spaceShowCandidates ()) { prepareCandidates (); update (); return TRUE; |