mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-195309 Support Ctrl+Backspace in SpeedSearch
This commit is contained in:
@@ -231,6 +231,13 @@ public class KeymapUtil {
|
||||
return shortcut == null? "" : getShortcutText(shortcut);
|
||||
}
|
||||
|
||||
public static boolean isEventForAction(@NotNull KeyEvent keyEvent, @NotNull String actionId) {
|
||||
for (KeyboardShortcut shortcut : ContainerUtil.findAll(getActiveKeymapShortcuts(actionId).getShortcuts(), KeyboardShortcut.class)) {
|
||||
if (AWTKeyStroke.getAWTKeyStrokeForEvent(keyEvent) == shortcut.getFirstKeyStroke()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getFirstKeyboardShortcutText(@NotNull AnAction action) {
|
||||
return getFirstKeyboardShortcutText(action.getShortcutSet());
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ui.speedSearch;
|
||||
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.codeStyle.AllOccurrencesMatcher;
|
||||
import com.intellij.psi.codeStyle.FixingLayoutMatcher;
|
||||
@@ -68,7 +69,15 @@ public class SpeedSearch extends SpeedSearchSupply implements KeyListener {
|
||||
|
||||
String old = myString;
|
||||
if (e.getID() == KeyEvent.KEY_PRESSED) {
|
||||
if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
|
||||
if (KeymapUtil.isEventForAction(e, "EditorDeleteToWordStart")) {
|
||||
if (isHoldingFilter()) {
|
||||
while (!myString.isEmpty() && !Character.isWhitespace(myString.charAt(myString.length() - 1))) {
|
||||
backspace();
|
||||
}
|
||||
e.consume();
|
||||
}
|
||||
}
|
||||
else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
|
||||
backspace();
|
||||
e.consume();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user