fixes aux text.
authorPeng Wu <alexepico@gmail.com>
Tue, 29 Jun 2010 06:50:10 +0000 (14:50 +0800)
committerPeng Wu <alexepico@gmail.com>
Tue, 29 Jun 2010 06:50:10 +0000 (14:50 +0800)
src/ExtEditor.cc
src/LookupTable.h

index b9f780b..ba61b71 100644 (file)
@@ -241,6 +241,7 @@ ExtEditor::processLabelKey (guint keyval)
             break;
         }
         break;
+    case LABEL_LIST_NUMBERS:
     case LABEL_LIST_ALPHA:
         switch (keyval) {
         case 'a' ... 'k':
@@ -406,7 +407,16 @@ ExtEditor::selectCandidate (guint index)
 {
     switch (m_mode) {
     case LABEL_LIST_NUMBERS:
-        //TODO: implement pinyin extension i number mode.
+        {
+            if ( index >= m_lookup_table.size() )
+                return FALSE;
+
+            IBusText * candidate = m_lookup_table.getCandidate(index);
+            Text text(candidate);
+            commitText(text);
+            reset();
+            return TRUE;
+        }
         break;
     case LABEL_LIST_COMMANDS:
         {
@@ -568,6 +578,9 @@ ExtEditor::updateStateFromInput (void)
     else if ( isdigit (m_text[1]) ) {
         m_mode = LABEL_LIST_NUMBERS;
         std::string number = m_text.substr(1);
+        m_auxiliary_text += " ";
+        m_auxiliary_text += number;
+
         //Generate Chinese number.
         int num = atoi(number.c_str());
         fillChineseNumber (num);
index eb2a041..d62b978 100644 (file)
@@ -53,6 +53,7 @@ public:
     void setLabel (guint index, IBusText *text) { ibus_lookup_table_set_label (*this, index, text); }
     void appendCandidate (IBusText *text)   { ibus_lookup_table_append_candidate (*this, text); }
     void appendLabel (IBusText *text)       { ibus_lookup_table_append_label (*this, text); }
+    IBusText * getCandidate(guint index)    { return ibus_lookup_table_get_candidate(*this, index); }
 
     operator IBusLookupTable * (void) const
     {