changeset 16470:d8ade1c5f823 v8.1.1239

patch 8.1.1239: key with byte sequence containing CSI does not work commit https://github.com/vim/vim/commit/a9dd2d3c759c1eafb9c0572c5707852ed3d38162 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 29 21:58:41 2019 +0200 patch 8.1.1239: key with byte sequence containing CSI does not work 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)
author Bram Moolenaar <Bram@vim.org>
date Mon, 29 Apr 2019 22:00:05 +0200
parents a31e4c1ee3ae
children 867d42d27690
files src/getchar.c src/version.c
diffstat 2 files changed, 19 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -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
 			    )
 		    {
--- a/src/version.c
+++ b/src/version.c
@@ -768,6 +768,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1239,
+/**/
     1238,
 /**/
     1237,