summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2015-09-11 11:55:59 +0800
committerPeng Wu <alexepico@gmail.com>2015-09-11 11:55:59 +0800
commitf69aa02f2318dff8af34993f57c924e3b1514c2f (patch)
treed7a42d7b1fb36569d35c9ec43ba878bd16e7093a
parent0ddb44c55238cbaa431aa1f525e8625563830d2a (diff)
downloadibus-libzhuyin-f69aa02f2318dff8af34993f57c924e3b1514c2f.tar.gz
ibus-libzhuyin-f69aa02f2318dff8af34993f57c924e3b1514c2f.tar.xz
ibus-libzhuyin-f69aa02f2318dff8af34993f57c924e3b1514c2f.zip
fixes input behavior
-rw-r--r--src/ZYZPhoneticEditor.cc20
-rw-r--r--src/ZYZPhoneticEditor.h5
2 files changed, 25 insertions, 0 deletions
diff --git a/src/ZYZPhoneticEditor.cc b/src/ZYZPhoneticEditor.cc
index 0672706..27b28be 100644
--- a/src/ZYZPhoneticEditor.cc
+++ b/src/ZYZPhoneticEditor.cc
@@ -79,6 +79,8 @@ PhoneticEditor::PhoneticEditor (ZhuyinProperties & props, Config & config)
loadEasySymbolFile (path) ||
loadEasySymbolFile (PKGDATADIR G_DIR_SEPARATOR_S "easysymbol.txt");
g_free(path);
+
+ m_moved_left = FALSE;
}
PhoneticEditor::~PhoneticEditor (void)
@@ -122,6 +124,12 @@ PhoneticEditor::processEscape (guint keyval, guint keycode,
STATE_USER_SYMBOL_SHOWN == m_input_state) {
m_input_state = STATE_INPUT;
+
+ if (m_moved_left) {
+ moveCursorRight ();
+ m_moved_left = FALSE;
+ }
+
update ();
return TRUE;
}
@@ -293,6 +301,12 @@ PhoneticEditor::processShowCandidateKey (guint keyval, guint keycode,
switch (keyval) {
case IBUS_Down:
case IBUS_KP_Down:
+ if (m_config.candidatesAfterCursor () &&
+ m_cursor == get_enhanced_text_length (m_text)) {
+ moveCursorLeft ();
+ m_moved_left = TRUE;
+ }
+
/* check phonetic or symbol section here */
prepareCandidates ();
break;
@@ -301,6 +315,12 @@ PhoneticEditor::processShowCandidateKey (guint keyval, guint keycode,
case IBUS_KP_Up:
m_lookup_table.clear ();
m_input_state = STATE_INPUT;
+
+ if (m_moved_left) {
+ moveCursorRight ();
+ m_moved_left = FALSE;
+ }
+
break;
default:
diff --git a/src/ZYZPhoneticEditor.h b/src/ZYZPhoneticEditor.h
index 9e178f8..bedb66c 100644
--- a/src/ZYZPhoneticEditor.h
+++ b/src/ZYZPhoneticEditor.h
@@ -130,6 +130,11 @@ protected:
zhuyin_instance_vec m_instances;
SymbolLookup m_easy_symbols;
+
+ /* move left one character when cursor is at the end,
+ * only in candidates after cursor option.
+ */
+ gboolean m_moved_left;
};
};