Patch 8.2.4837 (after patch 8.2.0919
Problem: Modifiers not simplified when timed out or using feedkeys() with
'n" flag.
Solution: Adjust how mapped flag and timeout are used. (closes #10305)
Files: src/getchar.c, src/testdir/test_paste.vim,
src/testdir/test_termcodes.vim
*** ../vim-8.2.4836/src/getchar.c 2022-04-27 11:57:57.581002707 +0100
--- src/getchar.c 2022-04-28 14:01:05.540668562 +0100
***************
*** 2699,2715 ****
* - and not an ESC sequence, not in insert mode or p_ek is on,
* - and when not timed out,
*/
! if ((no_mapping == 0 || allow_keys != 0)
! && (typebuf.tb_maplen == 0
|| (p_remap && typebuf.tb_noremap[
typebuf.tb_off] == RM_YES))
&& !*timedout)
! {
! keylen = check_termcode(max_mlen + 1, NULL, 0, NULL);
// If no termcode matched but 'pastetoggle' matched partially
// it's like an incomplete key sequence.
! if (keylen == 0 && save_keylen == KEYLEN_PART_KEY)
keylen = KEYLEN_PART_KEY;
// If no termcode matched, try to include the modifier into the
--- 2699,2717 ----
* - and not an ESC sequence, not in insert mode or p_ek is on,
* - and when not timed out,
*/
! if (no_mapping == 0 || allow_keys != 0)
! {
! if ((typebuf.tb_maplen == 0
|| (p_remap && typebuf.tb_noremap[
typebuf.tb_off] == RM_YES))
&& !*timedout)
! keylen = check_termcode(max_mlen + 1, NULL, 0, NULL);
! else
! keylen = 0;
// If no termcode matched but 'pastetoggle' matched partially
// it's like an incomplete key sequence.
! if (keylen == 0 && save_keylen == KEYLEN_PART_KEY && !*timedout)
keylen = KEYLEN_PART_KEY;
// If no termcode matched, try to include the modifier into the
*** ../vim-8.2.4836/src/testdir/test_paste.vim 2022-03-14 20:46:37.461884474
+0000
--- src/testdir/test_paste.vim 2022-04-28 14:01:05.540668562 +0100
***************
*** 2,7 ****
--- 2,8 ----
" Bracketed paste only works with "xterm". Not in GUI or Windows console.
source check.vim
+ source term_util.vim
CheckNotMSWindows
CheckNotGui
***************
*** 217,222 ****
--- 218,286 ----
bwipe!
endfunc
+ func Test_pastetoggle_timeout_no_typed_after_mapped()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set pastetoggle=abc
+ set ttimeoutlen=10000
+ imap d a
+ END
+ call writefile(lines, 'Xpastetoggle_no_typed_after_mapped.vim')
+ let buf = RunVimInTerminal('-S Xpastetoggle_no_typed_after_mapped.vim',
#{rows: 8})
+ call TermWait(buf)
+ call term_sendkeys(buf, ":call feedkeys('id', 't')\<CR>")
+ call term_wait(buf, 200)
+ call term_sendkeys(buf, 'bc')
+ " 'ttimeoutlen' should NOT apply
+ call WaitForAssert({-> assert_match('^-- INSERT --', term_getline(buf, 8))})
+
+ call StopVimInTerminal(buf)
+ call delete('Xpastetoggle_no_typed_after_mapped.vim')
+ endfunc
+
+ func Test_pastetoggle_timeout_typed_after_mapped()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set pastetoggle=abc
+ set ttimeoutlen=10000
+ imap d a
+ END
+ call writefile(lines, 'Xpastetoggle_typed_after_mapped.vim')
+ let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_mapped.vim',
#{rows: 8})
+ call TermWait(buf)
+ call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>")
+ call term_wait(buf, 200)
+ call term_sendkeys(buf, 'c')
+ " 'ttimeoutlen' should apply
+ call WaitForAssert({-> assert_match('^-- INSERT (paste) --',
term_getline(buf, 8))})
+
+ call StopVimInTerminal(buf)
+ call delete('Xpastetoggle_typed_after_mapped.vim')
+ endfunc
+
+ func Test_pastetoggle_timeout_typed_after_noremap()
+ CheckRunVimInTerminal
+
+ let lines =<< trim END
+ set pastetoggle=abc
+ set ttimeoutlen=10000
+ inoremap d a
+ END
+ call writefile(lines, 'Xpastetoggle_typed_after_noremap.vim')
+ let buf = RunVimInTerminal('-S Xpastetoggle_typed_after_noremap.vim',
#{rows: 8})
+ call TermWait(buf)
+ call term_sendkeys(buf, ":call feedkeys('idb', 't')\<CR>")
+ call term_wait(buf, 200)
+ call term_sendkeys(buf, 'c')
+ " 'ttimeoutlen' should apply
+ call WaitForAssert({-> assert_match('^-- INSERT (paste) --',
term_getline(buf, 8))})
+
+ call StopVimInTerminal(buf)
+ call delete('Xpastetoggle_typed_after_noremap.vim')
+ endfunc
+
" Test for restoring option values when 'paste' is disabled
func Test_paste_opt_restore()
set autoindent expandtab ruler showmatch
*** ../vim-8.2.4836/src/testdir/test_termcodes.vim 2022-04-27
11:57:57.581002707 +0100
--- src/testdir/test_termcodes.vim 2022-04-28 14:01:05.540668562 +0100
***************
*** 2444,2448 ****
--- 2444,2464 ----
bw!
endfunc
+ func Test_simplify_noremap()
+ call feedkeys("i\<*C-M>", 'nx')
+ call assert_equal('', getline(1))
+ call assert_equal([0, 2, 1, 0, 1], getcurpos())
+ bw!
+ endfunc
+
+ func Test_simplify_timedout()
+ inoremap <C-M>a b
+ call feedkeys("i\<*C-M>", 'xt')
+ call assert_equal('', getline(1))
+ call assert_equal([0, 2, 1, 0, 1], getcurpos())
+ iunmap <C-M>a
+ bw!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.4836/src/version.c 2022-04-28 12:00:45.113439274 +0100
--- src/version.c 2022-04-28 14:03:31.076406533 +0100
***************
*** 748,749 ****
--- 748,751 ----
{ /* Add new patch number below this line */
+ /**/
+ 4837,
/**/
--
hundred-and-one symptoms of being an internet addict:
85. Choice between paying Compuserve bill and paying for kids education
is a no brainer -- although a bit painful for your kids.
/// 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/20220428131055.5DB031C16CB%40moolenaar.net.