Patch 8.2.4829

6 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 26, 2022, 7:52:11 AM4/26/22
to vim...@googlegroups.com

Patch 8.2.4829
Problem: A key may be simplified to NUL.
Solution: Use K_ZERO instead. Use macros instead of hard coded values.
(closes #10290)
Files: src/getchar.c, src/misc2.c, src/testdir/test_termcodes.vim


*** ../vim-8.2.4828/src/getchar.c 2022-04-15 13:53:30.052708679 +0100
--- src/getchar.c 2022-04-26 12:47:08.398986047 +0100
***************
*** 1637,1643 ****
--- 1637,1647 ----
if (*modifiers & MOD_MASK_CTRL)
{
if ((c >= '`' && c <= 0x7f) || (c >= '@' && c <= '_'))
+ {
c &= 0x1f;
+ if (c == NUL)
+ c = K_ZERO;
+ }
else if (c == '6')
// CTRL-6 is equivalent to CTRL-^
c = 0x1e;
***************
*** 3661,3667 ****
for (;;)
{
len = ui_inchar(dum, DUM_LEN, 0L, 0);
! if (len == 0 || (len == 1 && dum[0] == 3))
break;
}
return retesc;
--- 3665,3671 ----
for (;;)
{
len = ui_inchar(dum, DUM_LEN, 0L, 0);
! if (len == 0 || (len == 1 && dum[0] == Ctrl_C))
break;
}
return retesc;
*** ../vim-8.2.4828/src/misc2.c 2022-03-22 20:42:09.174172862 +0000
--- src/misc2.c 2022-04-26 12:47:08.398986047 +0100
***************
*** 1561,1567 ****
key = Ctrl_chr(key);
modifiers &= ~MOD_MASK_CTRL;
// <C-@> is <Nul>
! if (key == 0)
key = K_ZERO;
if (did_simplify != NULL)
*did_simplify = TRUE;
--- 1561,1567 ----
key = Ctrl_chr(key);
modifiers &= ~MOD_MASK_CTRL;
// <C-@> is <Nul>
! if (key == NUL)
key = K_ZERO;
if (did_simplify != NULL)
*did_simplify = TRUE;
*** ../vim-8.2.4828/src/testdir/test_termcodes.vim 2022-04-20 19:55:34.055678776 +0100
--- src/testdir/test_termcodes.vim 2022-04-26 12:47:08.398986047 +0100
***************
*** 2437,2441 ****
--- 2437,2447 ----
call assert_notequal(-1, index(output, 'builtin_dumb'))
endfunc

+ func Test_simplify_ctrl_at()
+ " feeding unsimplified CTRL-@ should still trigger i_CTRL-@
+ call feedkeys("ifoo\<Esc>A\<*C-@>", 'xt')
+ call assert_equal('foofoo', getline(1))
+ endfunc
+

" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4828/src/version.c 2022-04-26 12:29:38.960587911 +0100
--- src/version.c 2022-04-26 12:49:59.090761452 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4829,
/**/

--
I'm trying to be an optimist, but I don't think it'll work.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages