fix speed search in structure view popup: caret now always at the end + do not reset...
authorAlexey Pegov <alexey.pegov@jetbrains.com>
Mon, 23 Aug 2010 15:54:11 +0000 (19:54 +0400)
committerAlexey Pegov <alexey.pegov@jetbrains.com>
Mon, 23 Aug 2010 15:54:11 +0000 (19:54 +0400)
platform/platform-impl/src/com/intellij/ui/SpeedSearchBase.java

index 1b78bc8b75087f74bc01ca4d7e02c5885159d895..95c1b02494e0da49a40f5de23658df93b3873423 100644 (file)
@@ -214,7 +214,7 @@ public abstract class SpeedSearchBase<Comp extends JComponent> {
       final Object element = it.next();
       if (isMatchingElement(element, _s)) return element;
     }
-    return current;
+    return isMatchingElement(current, _s) ? current : null;
   }
 
   @Nullable
@@ -233,7 +233,7 @@ public abstract class SpeedSearchBase<Comp extends JComponent> {
       final Object element = it.previous();
       if (isMatchingElement(element, _s)) return element;
     }
-    return selectedIndex != -1? current : null;
+    return selectedIndex != -1 && isMatchingElement(current, _s) ? current : null;
   }
 
   @Nullable
@@ -440,15 +440,20 @@ public abstract class SpeedSearchBase<Comp extends JComponent> {
         }
         return;
       }
-      super.processKeyEvent(e);
+      
       if (
-        i == KeyEvent.VK_BACK_SPACE ||
         i == KeyEvent.VK_HOME ||
         i == KeyEvent.VK_END ||
         i == KeyEvent.VK_UP ||
         i == KeyEvent.VK_DOWN
         ) {
         e.consume();
+        return;
+      }
+
+      super.processKeyEvent(e);
+      if (i == KeyEvent.VK_BACK_SPACE) {
+        e.consume();
       }
     }
   }