Patch 8.1.2346

11 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 26, 2019, 8:35:40 AM11/26/19
to vim...@googlegroups.com

Patch 8.1.2346
Problem: CTRL-R CTRL-R doesn't work with modifyOtherKeys.
Solution: Allow key codes when fetching argument for CTRL-R. (closes #5266)
Also fix CTRL-G in Insert mode.
Files: src/edit.c, src/ex_getln.c, src/testdir/test_termcodes.vim


*** ../vim-8.1.2345/src/edit.c 2019-11-21 17:13:12.624361334 +0100
--- src/edit.c 2019-11-26 14:25:45.333170361 +0100
***************
*** 3906,3911 ****
--- 3906,3912 ----
* deleted when ESC is hit.
*/
++no_mapping;
+ ++allow_keys;
regname = plain_vgetc();
LANGMAP_ADJUST(regname, TRUE);
if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
***************
*** 3919,3924 ****
--- 3920,3926 ----
LANGMAP_ADJUST(regname, TRUE);
}
--no_mapping;
+ --allow_keys;

#ifdef FEAT_EVAL
/* Don't call u_sync() while typing the expression or giving an error
***************
*** 4010,4017 ****
--- 4012,4021 ----
* deleted when ESC is hit.
*/
++no_mapping;
+ ++allow_keys;
c = plain_vgetc();
--no_mapping;
+ --allow_keys;
switch (c)
{
/* CTRL-G k and CTRL-G <Up>: cursor up to Insstart.col */
*** ../vim-8.1.2345/src/ex_getln.c 2019-11-23 21:55:52.758656249 +0100
--- src/ex_getln.c 2019-11-26 14:12:46.673352864 +0100
***************
*** 1747,1752 ****
--- 1747,1753 ----
#endif
putcmdline('"', TRUE);
++no_mapping;
+ ++allow_keys;
i = c = plain_vgetc(); /* CTRL-R <char> */
if (i == Ctrl_O)
i = Ctrl_R; /* CTRL-R CTRL-O == CTRL-R CTRL-R */
***************
*** 1754,1759 ****
--- 1755,1761 ----
c = plain_vgetc(); /* CTRL-R CTRL-R <char> */
extra_char = NUL;
--no_mapping;
+ --allow_keys;
#ifdef FEAT_EVAL
/*
* Insert the result of an expression.
*** ../vim-8.1.2345/src/testdir/test_termcodes.vim 2019-11-21 23:23:56.671658025 +0100
--- src/testdir/test_termcodes.vim 2019-11-26 14:25:00.217105317 +0100
***************
*** 1209,1214 ****
--- 1209,1235 ----
call RunTest_modifyOtherKeys(function('GetEscCodeCSIu'))
endfunc

+ func Test_modifyOtherKeys_no_mapping()
+ set timeoutlen=10
+
+ let @a = 'aaa'
+ call feedkeys(":let x = '" .. GetEscCodeCSI27('R', 5) .. GetEscCodeCSI27('R', 5) .. "a'\<CR>", 'Lx!')
+ call assert_equal("let x = 'aaa'", @:)
+
+ new
+ call feedkeys("a" .. GetEscCodeCSI27('R', 5) .. GetEscCodeCSI27('R', 5) .. "a\<Esc>", 'Lx!')
+ call assert_equal("aaa", getline(1))
+ bwipe!
+
+ new
+ call feedkeys("axx\<CR>yy" .. GetEscCodeCSI27('G', 5) .. GetEscCodeCSI27('K', 5) .. "a\<Esc>", 'Lx!')
+ call assert_equal("axx", getline(1))
+ call assert_equal("yy", getline(2))
+ bwipe!
+
+ set timeoutlen&
+ endfunc
+
func RunTest_mapping_shift(key, func)
call setline(1, '')
if a:key == '|'
*** ../vim-8.1.2345/src/version.c 2019-11-26 13:42:22.473957176 +0100
--- src/version.c 2019-11-26 14:04:59.618459484 +0100
***************
*** 739,740 ****
--- 739,742 ----
{ /* Add new patch number below this line */
+ /**/
+ 2346,
/**/

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///
Reply all
Reply to author
Forward
0 new messages