summaryrefslogtreecommitdiffstats
path: root/src/ZYZZhuyinEditor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ZYZZhuyinEditor.cc')
-rw-r--r--src/ZYZZhuyinEditor.cc41
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;