summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-11-12 14:48:40 +0800
committerPeng Wu <alexepico@gmail.com>2015-11-12 14:49:44 +0800
commit97abb6046bc5ed86902ad7582e62ac0f224fa93f (patch)
tree071b81682acf7df0e655a86308388db65075732e
parent44eae2a162a5ff8fed48958bcc367d7a1a40ea8a (diff)
downloadibus-libzhuyin-97abb6046bc5ed86902ad7582e62ac0f224fa93f.tar.gz
ibus-libzhuyin-97abb6046bc5ed86902ad7582e62ac0f224fa93f.tar.xz
ibus-libzhuyin-97abb6046bc5ed86902ad7582e62ac0f224fa93f.zip
fixes getCursorRight method
-rw-r--r--src/ZYZPhoneticEditor.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/ZYZPhoneticEditor.cc b/src/ZYZPhoneticEditor.cc
index 27b28be..74c7d70 100644
--- a/src/ZYZPhoneticEditor.cc
+++ b/src/ZYZPhoneticEditor.cc
@@ -733,7 +733,7 @@ PhoneticEditor::getCursorRight (void)
section_t type = probe_section_quick (enhanced_text, start_pos);
- /* only when in phonetic section, need adjustments. */
+ /* when in phonetic section, need adjustments. */
if (PHONETIC_SECTION == type) {
String section;
get_phonetic_section (enhanced_text, start_pos, end_pos, section);
@@ -745,7 +745,7 @@ PhoneticEditor::getCursorRight (void)
assert (cursor < section_len);
assert (parsed_len <= section_len);
- /* only when in parsed phonetic section, need adjustments. */
+ /* when in parsed phonetic section, need adjustments. */
if (cursor < parsed_len) {
guint16 offset = 0;
zhuyin_get_zhuyin_key_rest_offset (instance, cursor, &offset);
@@ -773,6 +773,31 @@ PhoneticEditor::getCursorRight (void)
}
}
+ probe_section_start (enhanced_text, m_cursor + 1,
+ cursor, index, start_pos);
+
+ type = probe_section_quick (enhanced_text, start_pos);
+
+ /* when besides phonetic section, need adjustments. */
+ if (PHONETIC_SECTION == type) {
+ zhuyin_instance_t * instance = m_instances[index];
+
+ guint len = 0;
+ zhuyin_get_n_zhuyin (instance, &len);
+
+ if (len) {
+ ChewingKeyRest * key_rest = NULL;
+ /* get the first zhuyin key. */
+ zhuyin_get_zhuyin_key_rest (instance, 0, &key_rest);
+
+ guint16 end = 0;
+ zhuyin_get_zhuyin_key_rest_positions
+ (instance, key_rest, NULL, &end);
+
+ return m_cursor + end;
+ }
+ }
+
return m_cursor + 1;
}