--- ./src/nativeinputserver.cpp.inputkey	2011-04-17 00:45:29.349013001 +0800
+++ ./src/nativeinputserver.cpp	2011-04-17 00:50:02.699012844 +0800
@@ -105,13 +105,14 @@
 //while mList.mHavePrev is updated in this routine
 bool NativeInputServer::ProcessKey(char c, string & rBuf) {
     int count;
+    static bool pressesc=0;
     string s;
     rBuf = "";
     assert(mpIme);
     bool flag = true;
     //wIldchar should not occur in 1st char so check mCount
-    if (mpIme->InCodeSet(c)
-            || (!mInput.empty() && mpIme->IsWildChar(c))) {
+    if ((mpIme->InCodeSet(c)
+            || (!mInput.empty() && mpIme->IsWildChar(c))) && (!pressesc)) {
         flag = false;
         while (!mStack.empty())
             mStack.pop();
@@ -163,10 +164,13 @@
     if(flag == true) {
         if (mList.mCount > 0) {
             switch (c) {
-                case 033:
+               /* case 033:
                     mpIme->Reset();
                     mInput = "";
                     mList.Reset();
+                    break;*/
+                case 033:
+                    pressesc=1;
                     break;
                 case ' ':
                 case 015: 	  //enter
@@ -175,6 +179,7 @@
                     mpIme->Reset();
                     mInput = "";
                     mList.Reset();
+                    pressesc=0;
                     break;
                 case '0':   //fall through
                     c = '1' + 9;
@@ -187,17 +192,32 @@
                 case '7':
                 case '8':
                 case '9':
-                    s = Select(c - '1');
-                    if (!s.empty()) {
-                        rBuf = s;
-                        mpIme->Reset();
-                        mInput = "";
-                        mList.Reset();
+                    if(!pressesc){
+                        s = Select(c - '1');
+                        if (!s.empty()) {
+                            rBuf = s;
+                            mpIme->Reset();
+                            mInput = "";
+                            mList.Reset();
+                        }
+                        else
+                            Beep();
+                    }else{
+                        assert(!"ALT_? key unsupport in this server!\n\
+                               remove them from keymap.");
+                        c -= ('0' + 1);
+                        s = Select(c);
+                        pressesc=0;
+                        if (!s.empty()) {
+                            rBuf = s;
+                            mpIme->Reset();
+                            mInput = "";
+                            mList.Reset();
+                        } else
+                            Beep();
                     }
-                    else
-                        Beep();
                     break;
-                case ALT_0:   //fall through
+/*                case ALT_0:   //fall through
                     c += 10;
                 case ALT_1:
                 case ALT_2:
@@ -209,20 +229,10 @@
                 case ALT_8:
                 case ALT_9:
                    //unfinished
-                    assert(!"ALT_? key unsupport in this server!\n\
-                           remove them from keymap.");
-                    c -= (ALT_0 + 1);
-                    s = Select(c);
-                    if (!s.empty()) {
-                        rBuf = s;
-                        mpIme->Reset();
-                        mInput = "";
-                        mList.Reset();
-                    } else
-                        Beep();
-                    break;
+                    break;*/
                 case '+':
                 case '=':
+                    pressesc=0;
                     if (mList.mHaveNext) {
                         int n = mList.mCount;
                         mpIme->Search(mInput, mWordOffset + n);
@@ -235,6 +245,7 @@
                     break;
                 case '-':
                 case '_':
+                    pressesc=0;
                     if (!mStack.empty()) {
                         assert(mList.mHavePrev);
                         mpIme->Search(mInput, mWordOffset -=
@@ -246,12 +257,14 @@
                     break;
                 case 010: 		/* BackSpace Ctrl+H */
                 case 0177: 		/* BackSpace */
+                    pressesc=0;
                     assert(!mInput.empty());
                     mInput.erase(mInput.end() - 1);
                     mList.Reset();
                     mpIme->Search(mInput, 0);
                     break;
                 default:
+                    pressesc=0;
                     if (mIsFullComma && IsSymbol(c)) {
                         s = Select(0);
                         s += GetFullSymbol(c);
