changeset 31111:f1cb6b4dbf72 v9.0.0890

patch 9.0.0890: no test for what patch 9.0.0827 fixes Commit: https://github.com/vim/vim/commit/1573e73f1c743d6792de8ee4b6f5b99545ebd3fb Author: Bram Moolenaar <Bram@vim.org> Date: Wed Nov 16 20:33:21 2022 +0000 patch 9.0.0890: no test for what patch 9.0.0827 fixes Problem: No test for what patch 9.0.0827 fixes. Solution: Add a test (still doesn't fail when fix is reverted).
author Bram Moolenaar <Bram@vim.org>
date Wed, 16 Nov 2022 21:45:03 +0100
parents 5fbfdada87aa
children ece7162dc34f
files src/evalvars.c src/term.c src/testdir/test_termcodes.vim src/version.c
diffstat 4 files changed, 41 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -1343,6 +1343,11 @@ skip_var_one(char_u *arg, int include_ty
 
     if (*arg == '@' && arg[1] != NUL)
 	return arg + 2;
+
+    // termcap option name may have non-alpha characters
+    if (STRNCMP(arg, "&t_", 3) == 0 && arg[3] != NUL && arg[4] != NUL)
+	return arg + 5;
+
     end = find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
 				   NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
 
--- a/src/term.c
+++ b/src/term.c
@@ -4720,7 +4720,7 @@ 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}
+	// Kitty up to 9.x sends 1;400{version};{secondary-version}
 	if (arg[0] == 1 && arg[1] >= 4000 && arg[1] <= 4009)
 	{
 	    term_props[TPR_KITTY].tpr_status = TPR_YES;
@@ -5520,7 +5520,8 @@ check_termcode(
 			    // no match for "code;*X" with "code;"
 			    continue;
 			else if (termcodes[idx].code[modslen] == '@'
-				     && (tp[modslen] != '1' || tp[modslen + 1] != ';'))
+					 && (tp[modslen] != '1'
+						    || tp[modslen + 1] != ';'))
 			    // no match for "<Esc>[@" with "<Esc>[1;"
 			    continue;
 			else
--- a/src/testdir/test_termcodes.vim
+++ b/src/testdir/test_termcodes.vim
@@ -2531,6 +2531,37 @@ func Test_special_term_keycodes()
   bw!
 endfunc
 
+func Test_home_key_works()
+  " The '@' character in K_HOME must only match "1" when followed by ";",
+  " otherwise this code for Home is not recognized: "<Esc>[1~"
+  " Set termcap values like "xterm" uses them.
+  let save_kh = &t_kh
+  let save_K1 = &t_K1
+  let save_k2 = &t_k2
+  let save_k3 = &t_k3
+  let save_end = &t_@7
+  let &t_K1 = "\<Esc>[1;*~"      " <kHome>
+  let &t_kh = "\<Esc>[@;*H"      " <Home>
+  let &t_k2 = "\<Esc>O*H[1;*~"   " use <F2> for <xHome>
+  let &t_k3 = "\<Esc>[7;*~"      " use <F3> for <zHome>
+  let &t_@7 = "\<Esc>[@;*F"      " <End>
+
+  new
+  call feedkeys("i\<C-K>\<Esc>OH\n\<Esc>", 'tx')
+  call feedkeys("i\<C-K>\<Esc>[1~\n\<Esc>", 'tx')
+  call assert_equal([
+        \ '<Home>',
+        \ '<kHome>',
+        \ ''], getline(1, '$'))
+
+  bwipe!
+  let &t_kh = save_kh
+  let &t_K1 = save_K1
+  let &t_k2 = save_k2
+  let &t_k3 = save_k3
+  let &t_@7 = save_end
+endfunc
+
 func Test_terminal_builtin_without_gui()
   CheckNotMSWindows
 
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    890,
+/**/
     889,
 /**/
     888,