summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2018-10-15 16:33:36 +0800
committerPeng Wu <alexepico@gmail.com>2018-10-15 16:33:36 +0800
commit4d768fd5f8cb47eca8ad03f45bde9b4acba7da4c (patch)
tree3921c3f181316f9d5c833d44b29b113bed263932
parent8149d9d308c4af3e4ec2b3598e58a5859f7156e5 (diff)
downloadibus-libzhuyin-4d768fd5f8cb47eca8ad03f45bde9b4acba7da4c.zip
ibus-libzhuyin-4d768fd5f8cb47eca8ad03f45bde9b4acba7da4c.tar.gz
ibus-libzhuyin-4d768fd5f8cb47eca8ad03f45bde9b4acba7da4c.tar.xz
fixes processSpace method
-rw-r--r--src/ZYZPhoneticEditor.cc3
-rw-r--r--src/ZYZPinyinEditor.cc4
-rw-r--r--src/ZYZZhuyinEditor.cc41
3 files changed, 30 insertions, 18 deletions
diff --git a/src/ZYZPhoneticEditor.cc b/src/ZYZPhoneticEditor.cc
index 77307c3..bf337f7 100644
--- a/src/ZYZPhoneticEditor.cc
+++ b/src/ZYZPhoneticEditor.cc
@@ -161,9 +161,12 @@ PhoneticEditor::processSpace (guint keyval, guint keycode,
return TRUE;
}
+#if 0
if (!m_config.spaceShowCandidates ()) {
return insert (keyval, keycode, modifiers);
}
+#endif
+ return FALSE;
}
if (STATE_CANDIDATE_SHOWN == m_input_state ||
diff --git a/src/ZYZPinyinEditor.cc b/src/ZYZPinyinEditor.cc
index 05e1c92..591518e 100644
--- a/src/ZYZPinyinEditor.cc
+++ b/src/ZYZPinyinEditor.cc
@@ -228,7 +228,9 @@ PinyinEditor::processSpace (guint keyval, guint keycode, guint modifiers)
if (cmshm_filter (modifiers) != 0)
return FALSE;
- if (m_config.spaceShowCandidates ()) {
+ if (!m_config.spaceShowCandidates ()) {
+ return insert (keyval, keycode, modifiers);
+ } else {
/* use space to show candidates. */
prepareCandidates ();
update ();
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;