]> granicus.if.org Git - vim/commitdiff
patch 8.1.1239: key with byte sequence containing CSI does not work v8.1.1239
authorBram Moolenaar <Bram@vim.org>
Mon, 29 Apr 2019 19:58:41 +0000 (21:58 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 29 Apr 2019 19:58:41 +0000 (21:58 +0200)
Problem:    Key with byte sequence containing CSI does not work.
Solution:   Do not recognize CSI as special unless the GUI is active. (Ken
            Takata, closes #4318)

src/getchar.c
src/version.c

index 2dc5e585ab938aec75814bcae8c654f7e2c74b63..a1ffced14ac1d867bf007f34b7c7ee38ebd0e90f 100644 (file)
@@ -1604,7 +1604,7 @@ vgetc(void)
            // Get two extra bytes for special keys
            if (c == K_SPECIAL
 #ifdef FEAT_GUI
-                   || c == CSI
+                   || (gui.in_use && c == CSI)
 #endif
               )
            {
@@ -1659,19 +1659,23 @@ vgetc(void)
                }
 #endif
 #ifdef FEAT_GUI
-               // Handle focus event here, so that the caller doesn't need to
-               // know about it.  Return K_IGNORE so that we loop once (needed
-               // if 'lazyredraw' is set).
-               if (c == K_FOCUSGAINED || c == K_FOCUSLOST)
+               if (gui.in_use)
                {
-                   ui_focus_change(c == K_FOCUSGAINED);
-                   c = K_IGNORE;
-               }
+                   // Handle focus event here, so that the caller doesn't
+                   // need to know about it.  Return K_IGNORE so that we loop
+                   // once (needed if 'lazyredraw' is set).
+                   if (c == K_FOCUSGAINED || c == K_FOCUSLOST)
+                   {
+                       ui_focus_change(c == K_FOCUSGAINED);
+                       c = K_IGNORE;
+                   }
 
-               // Translate K_CSI to CSI.  The special key is only used to
-               // avoid it being recognized as the start of a special key.
-               if (c == K_CSI)
-                   c = CSI;
+                   // Translate K_CSI to CSI.  The special key is only used
+                   // to avoid it being recognized as the start of a special
+                   // key.
+                   if (c == K_CSI)
+                       c = CSI;
+               }
 #endif
            }
            // a keypad or special function key was not mapped, use it like
@@ -1749,7 +1753,7 @@ vgetc(void)
                    buf[i] = vgetorpeek(TRUE);
                    if (buf[i] == K_SPECIAL
 #ifdef FEAT_GUI
-                           || buf[i] == CSI
+                           || (gui.in_use && buf[i] == CSI)
 #endif
                            )
                    {
index f8a66a07c582c81d6724bfbaa4011ab7167efa6d..29a1f031e1aa1589b964c21b4d6a75576dca0693 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1239,
 /**/
     1238,
 /**/