Patch 9.0.0813
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)
Files:      runtime/doc/builtin.txt, src/term.c,
            src/testdir/test_termcodes.vim


*** ../vim-9.0.0812/runtime/doc/builtin.txt     2022-10-21 11:25:25.689652476 
+0100
--- runtime/doc/builtin.txt     2022-10-21 14:02:37.643343378 +0100
***************
*** 9669,9674 ****
--- 9668,9674 ----
                   cursor_blink_mode    whether sending |t_RC| works  **
                   underline_rgb        whether |t_8u| works **
                   mouse                mouse type supported
+                  kitty                whether Kitty terminal was detected
  
                ** value 'u' for unknown, 'y' for yes, 'n' for no
  
*** ../vim-9.0.0812/src/term.c  2022-10-19 20:07:06.301844748 +0100
--- src/term.c  2022-10-21 14:16:18.891632522 +0100
***************
*** 1350,1357 ****
  #define TPR_UNDERLINE_RGB         2
  // mouse support - TPR_MOUSE_XTERM, TPR_MOUSE_XTERM2 or TPR_MOUSE_SGR
  #define TPR_MOUSE                 3
  // table size
! #define TPR_COUNT                 4
  
  static termprop_T term_props[TPR_COUNT];
  
--- 1350,1359 ----
  #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                 5
  
  static termprop_T term_props[TPR_COUNT];
  
***************
*** 1373,1378 ****
--- 1375,1382 ----
      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,4720 ****
--- 4719,4731 ----
        // 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,4854 ****
      int           modifiers;
      char_u  string[MAX_KEY_CODE_LEN + 1];
  
!     seenModifyOtherKeys = TRUE;
      if (trail == 'u')
        key = arg[0];
      else
--- 4859,4869 ----
      int           modifiers;
      char_u  string[MAX_KEY_CODE_LEN + 1];
  
!     // 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
*** ../vim-9.0.0812/src/testdir/test_termcodes.vim      2022-10-19 
15:12:51.102469412 +0100
--- src/testdir/test_termcodes.vim      2022-10-21 14:14:50.275620348 +0100
***************
*** 1647,1653 ****
          \ cursor_style: 'u',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's'
          \ }, terminalprops())
  
    set t_RV=
--- 1647,1654 ----
          \ cursor_style: 'u',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's',
!         \ kitty: 'u',
          \ }, terminalprops())
  
    set t_RV=
***************
*** 1681,1687 ****
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's'
          \ }, terminalprops())
  
    set t_RV=
--- 1682,1689 ----
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's',
!         \ kitty: 'u',
          \ }, terminalprops())
  
    set t_RV=
***************
*** 1700,1706 ****
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's'
          \ }, terminalprops())
  endfunc
  
--- 1702,1709 ----
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's',
!         \ kitty: 'u',
          \ }, terminalprops())
  endfunc
  
***************
*** 1742,1748 ****
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'y',
!         \ mouse: 's'
          \ }, terminalprops())
    call assert_equal("\<Esc>[58;2;%lu;%lu;%lum", &t_8u)
  
--- 1745,1752 ----
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'y',
!         \ mouse: 's',
!         \ kitty: 'u',
          \ }, terminalprops())
    call assert_equal("\<Esc>[58;2;%lu;%lu;%lum", &t_8u)
  
***************
*** 1772,1778 ****
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'y',
!         \ mouse: 's'
          \ }, terminalprops())
  
    set t_RV=
--- 1776,1783 ----
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'y',
!         \ mouse: 's',
!         \ kitty: 'u',
          \ }, terminalprops())
  
    set t_RV=
***************
*** 1807,1813 ****
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'n',
          \ underline_rgb: 'y',
!         \ mouse: 's'
          \ }, terminalprops())
  
    set t_RV=
--- 1812,1819 ----
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'n',
          \ underline_rgb: 'y',
!         \ mouse: 's',
!         \ kitty: 'u',
          \ }, terminalprops())
  
    set t_RV=
***************
*** 1831,1837 ****
          \ cursor_style: 'u',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's'
          \ }, terminalprops())
    call assert_equal(a:set_by_user ? default_value : '', &t_8u)
  endfunc
--- 1837,1844 ----
          \ cursor_style: 'u',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's',
!         \ kitty: 'u',
          \ }, terminalprops())
    call assert_equal(a:set_by_user ? default_value : '', &t_8u)
  endfunc
***************
*** 1867,1873 ****
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'y',
!         \ mouse: 'u'
          \ }, terminalprops())
  
    " xterm >= 95 < 277 "xterm2"
--- 1874,1881 ----
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'y',
!         \ mouse: 'u',
!         \ kitty: 'u',
          \ }, terminalprops())
  
    " xterm >= 95 < 277 "xterm2"
***************
*** 1882,1888 ****
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: '2'
          \ }, terminalprops())
  
    " xterm >= 277: "sgr"
--- 1890,1897 ----
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: '2',
!         \ kitty: 'u',
          \ }, terminalprops())
  
    " xterm >= 277: "sgr"
***************
*** 1897,1903 ****
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's'
          \ }, terminalprops())
  
    " xterm >= 279: "sgr" and cursor_style not reset; also check t_8u reset,
--- 1906,1913 ----
          \ cursor_style: 'n',
          \ cursor_blink_mode: 'u',
          \ underline_rgb: 'u',
!         \ mouse: 's',
!         \ kitty: 'u',
          \ }, terminalprops())
  
    " xterm >= 279: "sgr" and cursor_style not reset; also check t_8u reset,
***************
*** 1907,1912 ****
--- 1917,1946 ----
  
    set t_RV=
    call test_override('term_props', 0)
+ endfunc
+ 
+ func Test_xx08_kitty_response()
+   " Termresponse is only parsed when t_RV is not empty.
+   set t_RV=x
+   call test_override('term_props', 1)
+ 
+   set ttymouse=xterm
+   call test_option_not_set('ttymouse')
+   let seq = "\<Esc>[>1;4001;12c"
+   call feedkeys(seq, 'Lx!')
+   call assert_equal(seq, v:termresponse)
+   call assert_equal('sgr', &ttymouse)
+ 
+   call assert_equal(#{
+         \ cursor_style: 'u',
+         \ cursor_blink_mode: 'u',
+         \ underline_rgb: 'y',
+         \ mouse: 's',
+         \ kitty: 'y',
+         \ }, terminalprops())
+ 
+   set t_RV=
+   call test_override('term_props', 0)
  endfunc
  
  func Test_focus_events()
*** ../vim-9.0.0812/src/version.c       2022-10-21 13:03:29.179682686 +0100
--- src/version.c       2022-10-21 14:00:42.963247959 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     813,
  /**/

-- 
SOLDIER: What? A swallow carrying a coconut?
ARTHUR:  It could grip it by the husk ...
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221021131801.22F8A1C0762%40moolenaar.net.

Raspunde prin e-mail lui