return phrase.len > 1 && phrase.user_freq > 0 && phrase.freq == 0;
}
+ gboolean unselectCandidates (void) {
+ if (m_cursor == 0) {
+ return FALSE;
+ }
+ else {
+ m_selected_phrases.removeAll ();
+ m_selected_string.truncate (0);
+ m_cursor = 0;
+ updateCandidates ();
+ return TRUE;
+ }
+ }
+
void reset (void) {
m_candidates.removeAll ();
m_selected_phrases.removeAll ();
break;
case IBUS_BackSpace:
- removeCharBefore ();
+ if (m_phrase_editor.unselectCandidates ()) {
+ update ();
+ }
+ else {
+ removeCharBefore ();
+ }
break;
case IBUS_Delete:
case IBUS_Left:
case IBUS_KP_Left:
- moveCursorLeft ();
+ if (m_phrase_editor.unselectCandidates ()) {
+ update ();
+ }
+ else {
+ moveCursorLeft ();
+ }
break;
case IBUS_Right:
case IBUS_Home:
case IBUS_KP_Home:
- moveCursorToBegin ();
+ if (m_phrase_editor.unselectCandidates ()) {
+ update ();
+ }
+ else {
+ moveCursorToBegin ();
+ }
break;
case IBUS_End:
else {
switch (keyval) {
case IBUS_BackSpace:
- removeWordBefore ();
+ if (m_phrase_editor.unselectCandidates ()) {
+ update ();
+ }
+ else {
+ removeWordBefore ();
+ }
break;
case IBUS_Delete:
case IBUS_Left:
case IBUS_KP_Left:
- moveCursorLeftByWord ();
+ if (m_phrase_editor.unselectCandidates ()) {
+ update ();
+ }
+ else {
+ moveCursorLeftByWord ();
+ }
break;
case IBUS_Right: