From c202394c3c8b06b4463aaf90d3b7a52d1dfd4406 Mon Sep 17 00:00:00 2001
From: Alex Plate <aleksei.plate@jetbrains.com>
Date: Wed, 10 Apr 2019 12:48:30 +0300
Subject: [PATCH] [VIM-1628] Do not handle undefined characters

---
 src/com/maddyhome/idea/vim/VimTypedActionHandler.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/com/maddyhome/idea/vim/VimTypedActionHandler.java b/src/com/maddyhome/idea/vim/VimTypedActionHandler.java
index a802eace0..db5ad5bae 100644
--- a/src/com/maddyhome/idea/vim/VimTypedActionHandler.java
+++ b/src/com/maddyhome/idea/vim/VimTypedActionHandler.java
@@ -22,14 +22,15 @@ import com.intellij.codeInsight.lookup.Lookup;
 import com.intellij.codeInsight.lookup.LookupManager;
 import com.intellij.openapi.actionSystem.DataContext;
 import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.actionSystem.ActionPlan;
 import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.editor.actionSystem.ActionPlan;
 import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
 import com.intellij.openapi.editor.actionSystem.TypedActionHandlerEx;
 import com.maddyhome.idea.vim.helper.EditorDataContext;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
+import java.awt.event.KeyEvent;
 
 /**
  * Accepts all regular keystrokes and passes them on to the Vim key handler.
@@ -63,7 +64,7 @@ public class VimTypedActionHandler implements TypedActionHandlerEx {
 
   @Override
   public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext context) {
-    if (isEnabled(editor)) {
+    if (isEnabled(editor) && charTyped != KeyEvent.CHAR_UNDEFINED) {
       try {
         handler.handleKey(editor, KeyStroke.getKeyStroke(charTyped), new EditorDataContext(editor));
       }