Patch 8.0.0302
Problem: Cannot set terminal key codes with :let.
Solution: Make it work.
Files: src/option.c, src/testdir/test_assign.vim
*** ../vim-8.0.0301/src/option.c 2017-01-28 15:58:45.348197250 +0100
--- src/option.c 2017-02-04 19:29:50.097068632 +0100
***************
*** 9197,9203 ****
--- 9197,9231 ----
opt_idx = findoption(name);
if (opt_idx < 0) /* unknown option */
+ {
+ int key;
+
+ if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
+ && (key = find_key_option(name)) != 0)
+ {
+ char_u key_name[2];
+ char_u *p;
+
+ if (key < 0)
+ {
+ key_name[0] = KEY2TERMCAP0(key);
+ key_name[1] = KEY2TERMCAP1(key);
+ }
+ else
+ {
+ key_name[0] = KS_KEY;
+ key_name[1] = (key & 0xff);
+ }
+ p = find_termcode(key_name);
+ if (p != NULL)
+ {
+ if (stringval != NULL)
+ *stringval = vim_strsave(p);
+ return 0;
+ }
+ }
return -3;
+ }
varp = get_varp_scope(&(options[opt_idx]), opt_flags);
***************
*** 9455,9461 ****
--- 9483,9515 ----
opt_idx = findoption(name);
if (opt_idx < 0)
+ {
+ int key;
+
+ if (STRLEN(name) == 4 && name[0] == 't' && name[1] == '_'
+ && (key = find_key_option(name)) != 0)
+ {
+ char_u key_name[2];
+
+ if (key < 0)
+ {
+ key_name[0] = KEY2TERMCAP0(key);
+ key_name[1] = KEY2TERMCAP1(key);
+ }
+ else
+ {
+ key_name[0] = KS_KEY;
+ key_name[1] = (key & 0xff);
+ }
+ add_termcode(key_name, string, FALSE);
+ if (full_screen)
+ ttest(FALSE);
+ redraw_all_later(CLEAR);
+ return NULL;
+ }
+
EMSG2(_("E355: Unknown option: %s"), name);
+ }
else
{
flags = options[opt_idx].flags;
*** ../vim-8.0.0301/src/testdir/test_assign.vim 2016-03-12 18:59:21.000000000
+0100
--- src/testdir/test_assign.vim 2017-02-04 19:32:17.739978777 +0100
***************
*** 7,9 ****
--- 7,29 ----
let v = 3.4
let v = 'hello'
endfunc
+
+ func Test_let_termcap()
+ " Terminal code
+ let old_t_te = &t_te
+ let &t_te = "\<Esc>[yes;"
+ call assert_match('t_te.*^[[yes;', execute("set termcap"))
+ let &t_te = old_t_te
+
+ " Key code
+ let old_t_k1 = &t_k1
+ let &t_k1 = "that"
+ call assert_match('t_k1.*that', execute("set termcap"))
+ let &t_k1 = old_t_k1
+
+ call assert_fails('let x = &t_xx', 'E15')
+ let &t_xx = "yes"
+ call assert_equal("yes", &t_xx)
+ let &t_xx = ""
+ call assert_fails('let x = &t_xx', 'E15')
+ endfunc
*** ../vim-8.0.0301/src/version.c 2017-02-04 15:53:27.759771102 +0100
--- src/version.c 2017-02-04 19:21:39.624690924 +0100
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 302,
/**/
--
Biting someone with your natural teeth is "simple assault," while biting
someone with your false teeth is "aggravated assault."
[real standing law in Louisana, United States of America]
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ 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].
For more options, visit https://groups.google.com/d/optout.