diff src/term.c @ 30958:122f883d7237 v9.0.0813

patch 9.0.0813: Kitty terminal is not recognized Commit: https://github.com/vim/vim/commit/4bc85f23ed2cf1fab20597ff15cefa675ea5e2c6 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 21 14:17:24 2022 +0100 patch 9.0.0813: Kitty terminal is not recognized Problem: Kitty terminal is not recognized. Solution: Recognize Kitty by the termresponse and then do not set seenModifyOtherKeys, since Kitty doesn't support that. (issue #11413)
author Bram Moolenaar <Bram@vim.org>
date Fri, 21 Oct 2022 15:30:03 +0200
parents a07193ed51cd
children a82629ff46c8
line wrap: on
line diff
--- a/src/term.c
+++ b/src/term.c
@@ -1350,8 +1350,10 @@ typedef struct {
 #define TPR_UNDERLINE_RGB	    2
 // mouse support - TPR_MOUSE_XTERM, TPR_MOUSE_XTERM2 or TPR_MOUSE_SGR
 #define TPR_MOUSE		    3
+// term response indicates kitty
+#define TPR_KITTY		    4
 // table size
-#define TPR_COUNT		    4
+#define TPR_COUNT		    5
 
 static termprop_T term_props[TPR_COUNT];
 
@@ -1373,6 +1375,8 @@ init_term_props(int all)
     term_props[TPR_UNDERLINE_RGB].tpr_set_by_termresponse = TRUE;
     term_props[TPR_MOUSE].tpr_name = "mouse";
     term_props[TPR_MOUSE].tpr_set_by_termresponse = TRUE;
+    term_props[TPR_KITTY].tpr_name = "kitty";
+    term_props[TPR_KITTY].tpr_set_by_termresponse = FALSE;
 
     for (i = 0; i < TPR_COUNT; ++i)
 	if (all || term_props[i].tpr_set_by_termresponse)
@@ -4715,6 +4719,13 @@ handle_version_response(int first, int *
 	// else if (version == 115 && arg[0] == 0 && arg[2] == 0)
 	//     term_props[TPR_UNDERLINE_RGB].tpr_status = TPR_YES;
 
+	// Kitty sends 1;400{version};{secondary-version}
+	if (arg[0] == 1 && arg[1] >= 4000 && arg[1] <= 4009)
+	{
+	    term_props[TPR_KITTY].tpr_status = TPR_YES;
+	    term_props[TPR_KITTY].tpr_set_by_termresponse = TRUE;
+	}
+
 	// GNU screen sends 83;30600;0, 83;40500;0, etc.
 	// 30600/40500 is a version number of GNU screen. DA2 support is added
 	// on 3.6.  DCS string has a special meaning to GNU screen, but xterm
@@ -4848,7 +4859,11 @@ handle_key_with_modifier(
     int	    modifiers;
     char_u  string[MAX_KEY_CODE_LEN + 1];
 
-    seenModifyOtherKeys = TRUE;
+    // Do not set seenModifyOtherKeys for kitty, it does send some sequences
+    // like this but does not have the modifyOtherKeys feature.
+    if (term_props[TPR_KITTY].tpr_status != TPR_YES)
+	seenModifyOtherKeys = TRUE;
+
     if (trail == 'u')
 	key = arg[0];
     else