summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-06-05 13:05:59 +0800
committerPeng Wu <alexepico@gmail.com>2015-06-05 13:05:59 +0800
commitedde3c5afc1d617cd4261c7c502739cc50a5b1a4 (patch)
treee2183b0e2c6881612478d2f07356e732529348c2
parentea4dd5e39f3430041350bfa9d6db608d4a9ea6c3 (diff)
downloadibus-libzhuyin-edde3c5afc1d617cd4261c7c502739cc50a5b1a4.tar.gz
ibus-libzhuyin-edde3c5afc1d617cd4261c7c502739cc50a5b1a4.tar.xz
ibus-libzhuyin-edde3c5afc1d617cd4261c7c502739cc50a5b1a4.zip
fixes ZhuyinEditor::updateZhuyin
-rw-r--r--src/ZYZZhuyinEditor.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/ZYZZhuyinEditor.cc b/src/ZYZZhuyinEditor.cc
index affb948..a0f004c 100644
--- a/src/ZYZZhuyinEditor.cc
+++ b/src/ZYZZhuyinEditor.cc
@@ -26,6 +26,7 @@
#include "ZYZhuyinProperties.h"
#include "ZYTradSimpConverter.h"
#include "ZYEnhancedText.h"
+#include "ZYSymbols.h"
using namespace ZY;
@@ -82,9 +83,25 @@ ZhuyinEditor::updateZhuyin (void)
get_phonetic_section (enhanced_text, start_pos, end_pos, section);
zhuyin_instance_t * instance = m_instances[index];
- zhuyin_parse_more_chewings (instance, section.c_str ());
+ size_t len = zhuyin_parse_more_chewings
+ (instance, section.c_str ());
zhuyin_guess_sentence (instance);
+ /* check whether the last character is space,
+ if not part of parsed chewing input,
+ turn the space into symbol. */
+ if (end_pos == m_text.size () &&
+ ' ' == section[section.size () - 1] &&
+ section.size () > len) {
+ size_t length = get_enhanced_text_length (m_text);
+ erase_input_sequence (m_text, length - 1, 1);
+ insert_symbol (m_text, length - 1, BUILTIN_SYMBOL_TYPE,
+ "", " ");
+ /* as we changed the last space character,
+ reached the end of user input, exit the loop. */
+ break;
+ }
+
++index;
}