Patch 8.2.3864
Problem:    Cannot disable requesting key codes from xterm.
Solution:   Add the 'xtermcodes' option, default on.
Files:      runtime/doc/options.txt, runtime/doc/term.txt, src/option.h,
            src/optiondefs.h, src/term.c, runtime/optwin.vim


*** ../vim-8.2.3863/runtime/doc/options.txt     2021-12-11 17:24:00.228970299 
+0000
--- runtime/doc/options.txt     2021-12-21 08:58:54.406984790 +0000
***************
*** 9206,9209 ****
--- 9206,9221 ----
        screen.  When non-zero, characters are sent to the terminal one by
        one.  For debugging purposes.
  
+                                          *'xtermcodes'* *'noxtermcodes'*
+ 'xtermcodes'          boolean (default on)
+                       global
+       When detecting xterm patchlevel 141 or higher with the termresponse
+       mechanism and this option is set, Vim will request the actual termimal
+       key codes and number of colors from the terminal.  This takes care of
+       various configuration options of the terminal that cannot be obtained
+       from the termlib/terminfo entry, see |xterm-codes|.
+       A side effect may be that t_Co changes and Vim will redraw the
+       display.
+ 
+ 
   vim:tw=78:ts=8:noet:ft=help:norl:
*** ../vim-8.2.3863/runtime/doc/term.txt        2021-01-31 16:02:06.262490144 
+0000
--- runtime/doc/term.txt        2021-12-21 08:53:05.135850206 +0000
***************
*** 511,518 ****
  adjust the various t_ codes.  This avoids the problem that the xterm can
  produce different codes, depending on the mode it is in (8-bit, VT102,
  VT220, etc.).  The result is that codes like <xF1> are no longer needed.
! Note: This is only done on startup.  If the xterm options are changed after
! Vim has started, the escape sequences may not be recognized anymore.
  
                                                        *xterm-true-color*
  Vim supports using true colors in the terminal (taken from |highlight-guifg|
--- 556,570 ----
  adjust the various t_ codes.  This avoids the problem that the xterm can
  produce different codes, depending on the mode it is in (8-bit, VT102,
  VT220, etc.).  The result is that codes like <xF1> are no longer needed.
! 
! One of the codes that can change is 't_Co', the number of colors.  This will
! trigger a redraw.  If this is a problem, reset the 'xtermcodes' option as
! early as possible: >
!       set noxtermcodes
! 
! Note: Requesting the key codes is only done on startup.  If the xterm options
! are changed after Vim has started, the escape sequences may not be recognized
! anymore.
  
                                                        *xterm-true-color*
  Vim supports using true colors in the terminal (taken from |highlight-guifg|
*** ../vim-8.2.3863/src/option.h        2021-12-11 12:26:55.924402407 +0000
--- src/option.h        2021-12-21 09:01:43.650701283 +0000
***************
*** 485,490 ****
--- 485,491 ----
  #ifdef FEAT_EVAL
  EXTERN char_u *p_ccv;         // 'charconvert'
  #endif
+ EXTERN int    p_cdh;          // 'cdhome'
  EXTERN char_u *p_cino;        // 'cinoptions'
  #ifdef FEAT_CMDWIN
  EXTERN char_u *p_cedit;       // 'cedit'
***************
*** 1094,1100 ****
  EXTERN int    p_wa;           // 'writeany'
  EXTERN int    p_wb;           // 'writebackup'
  EXTERN long   p_wd;           // 'writedelay'
! EXTERN int    p_cdh;          // 'cdhome'
  
  /*
   * "indir" values for buffer-local options.
--- 1095,1101 ----
  EXTERN int    p_wa;           // 'writeany'
  EXTERN int    p_wb;           // 'writebackup'
  EXTERN long   p_wd;           // 'writedelay'
! EXTERN int    p_xtermcodes;   // 'xtermcodes'
  
  /*
   * "indir" values for buffer-local options.
*** ../vim-8.2.3863/src/optiondefs.h    2021-12-11 12:26:55.924402407 +0000
--- src/optiondefs.h    2021-12-21 09:00:09.690865541 +0000
***************
*** 2941,2946 ****
--- 2941,2949 ----
      {"writedelay",  "wd",   P_NUM|P_VI_DEF,
                            (char_u *)&p_wd, PV_NONE,
                            {(char_u *)0L, (char_u *)0L} SCTX_INIT},
+     {"xtermcodes",  NULL,   P_BOOL|P_VI_DEF,
+                           (char_u *)&p_xtermcodes, PV_NONE,
+                           {(char_u *)TRUE, (char_u *)0L} SCTX_INIT},
  
  // terminal output codes
  #define p_term(sss, vvv)   {sss, NULL, P_STRING|P_VI_DEF|P_RALL|P_SECURE, \
*** ../vim-8.2.3863/src/term.c  2021-12-05 22:19:22.840153470 +0000
--- src/term.c  2021-12-21 08:53:43.475734358 +0000
***************
*** 4694,4700 ****
  
        // If xterm version >= 141 try to get termcap codes.  For other
        // terminals the request should be ignored.
!       if (version >= 141)
        {
            LOG_TR(("Enable checking for XT codes"));
            check_for_codes = TRUE;
--- 4694,4700 ----
  
        // If xterm version >= 141 try to get termcap codes.  For other
        // terminals the request should be ignored.
!       if (version >= 141 && p_xtermcodes)
        {
            LOG_TR(("Enable checking for XT codes"));
            check_for_codes = TRUE;
***************
*** 6446,6453 ****
            if (name[0] == 'C' && name[1] == 'o')
            {
                // Color count is not a key code.
!               i = atoi((char *)str);
!               may_adjust_color_count(i);
            }
            else
            {
--- 6446,6452 ----
            if (name[0] == 'C' && name[1] == 'o')
            {
                // Color count is not a key code.
!               may_adjust_color_count(atoi((char *)str));
            }
            else
            {
*** ../vim-8.2.3863/runtime/optwin.vim  2021-12-11 12:33:22.127457639 +0000
--- runtime/optwin.vim  2021-12-21 09:04:48.410338513 +0000
***************
*** 1,7 ****
  " These commands create the option window.
  "
  " Maintainer: Bram Moolenaar <[email protected]>
! " Last Change:        2021 Dec 11
  
  " If there already is an option window, jump to that one.
  let buf = bufnr('option-window')
--- 1,7 ----
  " These commands create the option window.
  "
  " Maintainer: Bram Moolenaar <[email protected]>
! " Last Change:        2021 Dec 21
  
  " If there already is an option window, jump to that one.
  let buf = bufnr('option-window')
***************
*** 260,269 ****
  call <SID>AddOption("path", gettext("list of directory names used for file 
searching"))
  call append("$", "\t" .. s:global_or_local)
  call <SID>OptionG("pa", &pa)
! if exists("+cdhome")
!   call <SID>AddOption("cdhome", gettext("change directory to the home 
directory by :cd"))
!   call <SID>BinOptionG("cdh", &cdh)
! endif
  call <SID>AddOption("cdpath", gettext("list of directory names used for :cd"))
  call <SID>OptionG("cd", &cd)
  if exists("+autochdir")
--- 260,267 ----
  call <SID>AddOption("path", gettext("list of directory names used for file 
searching"))
  call append("$", "\t" .. s:global_or_local)
  call <SID>OptionG("pa", &pa)
! call <SID>AddOption("cdhome", gettext(":cd without argument goes to the home 
directory"))
! call <SID>BinOptionG("cdh", &cdh)
  call <SID>AddOption("cdpath", gettext("list of directory names used for :cd"))
  call <SID>OptionG("cd", &cd)
  if exists("+autochdir")
***************
*** 564,577 ****
--- 562,583 ----
  call <SID>Header(gettext("terminal"))
  call <SID>AddOption("term", gettext("name of the used terminal"))
  call <SID>OptionG("term", &term)
+ 
  call <SID>AddOption("ttytype", gettext("alias for 'term'"))
  call <SID>OptionG("tty", &tty)
+ 
  call <SID>AddOption("ttybuiltin", gettext("check built-in termcaps first"))
  call <SID>BinOptionG("tbi", &tbi)
+ 
  call <SID>AddOption("ttyfast", gettext("terminal connection is fast"))
  call <SID>BinOptionG("tf", &tf)
+ 
+ call <SID>AddOption("xtermcodes", gettext("request terminal key codes when an 
xterm is detected"))
+ call <SID>BinOptionG("xtermcodes", &xtermcodes)
+ 
  call <SID>AddOption("weirdinvert", gettext("terminal that requires extra 
redrawing"))
  call <SID>BinOptionG("wiv", &wiv)
+ 
  call <SID>AddOption("esckeys", gettext("recognize keys that start with <Esc> 
in Insert mode"))
  call <SID>BinOptionG("ek", &ek)
  call <SID>AddOption("scrolljump", gettext("minimal number of lines to scroll 
at a time"))
*** ../vim-8.2.3863/src/version.c       2021-12-20 22:12:49.334012134 +0000
--- src/version.c       2021-12-21 08:57:54.163070993 +0000
***************
*** 751,752 ****
--- 751,754 ----
  {   /* Add new patch number below this line */
+ /**/
+     3864,
  /**/

-- 
>From "know your smileys":
 :-)    Funny
 |-)    Funny Oriental
 (-:    Funny Australian

 /// 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/20211221091259.E92B41C16BF%40moolenaar.net.

Raspunde prin e-mail lui