mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-03-04 21:32:52 +01:00
Handle <Esc> in inputKeyStroke() uniformly as "typed Esc"
This commit is contained in:
parent
c33d4d989e
commit
69a573a279
src/com/maddyhome/idea/vim/extension
@ -108,7 +108,7 @@ public class VimExtensionFacade {
|
||||
dialog.setVisible(true);
|
||||
key = ref.get();
|
||||
}
|
||||
return key != null ? key : KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
|
||||
return key != null ? key : KeyStroke.getKeyStroke((char)KeyEvent.VK_ESCAPE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,11 +118,8 @@ public class VimSurroundExtension extends VimNonDisposableExtension {
|
||||
|
||||
private static char getChar(@NotNull Editor editor) {
|
||||
final KeyStroke key = inputKeyStroke(editor);
|
||||
if (key.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
return 0;
|
||||
}
|
||||
final char keyChar = key.getKeyChar();
|
||||
if (keyChar == KeyEvent.CHAR_UNDEFINED) {
|
||||
if (keyChar == KeyEvent.CHAR_UNDEFINED || keyChar == KeyEvent.VK_ESCAPE) {
|
||||
return 0;
|
||||
}
|
||||
return keyChar;
|
||||
@ -255,14 +252,10 @@ public class VimSurroundExtension extends VimNonDisposableExtension {
|
||||
private static class Operator implements OperatorFunction {
|
||||
@Override
|
||||
public boolean apply(@NotNull Editor editor, @NotNull DataContext context, @NotNull SelectionType selectionType) {
|
||||
final KeyStroke keyStroke = inputKeyStroke(editor);
|
||||
if (keyStroke.getKeyCode() == KeyEvent.VK_ESCAPE) {
|
||||
final char c = getChar(editor);
|
||||
if (c == 0) {
|
||||
return true;
|
||||
}
|
||||
final char c = keyStroke.getKeyChar();
|
||||
if (c == KeyEvent.CHAR_UNDEFINED) {
|
||||
return false;
|
||||
}
|
||||
final Pair<String, String> pair = getOrInputPair(c, editor);
|
||||
if (pair == null) {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user