Mapping C-L to Esc doesn't work correctly in macros:
:inoremap <C-L> <Esc>ivim<CR>devs<C-L>ggqqIhi <C-L>j@qResult:
hi vim
hi �üLdevs
When playing a macro, mappings should work the same as they while recording the macro. Using Ctrl in a mapping shouldn't replay as special characters. This was the behaviour on vim 8.2. I can verify that it works this way on 8.1.2269 (in a terminal) and I think it was also correct on 8.2.3399.
Expected:
hi vim
hi devs
9.0.636
Win 10 21H2
gvim
Using build of vim from scoop (installer from https://github.com/vim/vim-win32-installer)
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
This fixes the bug:
diff --git a/src/map.c b/src/map.c index d063e053a..3463adcf1 100644 --- a/src/map.c +++ b/src/map.c @@ -1753,7 +1753,11 @@ vim_strsave_escape_csi(char_u *p) d = res; for (s = p; *s != NUL; ) { - if (s[0] == K_SPECIAL && s[1] != NUL && s[2] != NUL) + if ((s[0] == K_SPECIAL +#ifdef FEAT_GUI + || s[0] == CSI +#endif + ) && s[1] != NUL && s[2] != NUL) { // Copy special key unmodified. *d++ = *s++;
Not sure if it is possible to write a test.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Wow, fast find! And I didn't realize it was gui-only, but testing in terminal vim9 I don't can't repro.
For tests, https://github.com/vim/vim/blob/master/src/testdir/test_gui.vim doesn't seem to have any macro tests. I was using let @q = to convert my broken macros into working ones, so that's not a valid way to test. feedkeys("qqIhi\<C-L>q@q") doesn't work and feedkeys("qqIhi\<C-L>q@q", "L") (or "t") don't exhibit the bug.
Not sure how you can test without a script that sends keys to vim.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Note: unlike a previous issue, the #ifdef FEAT_GUI in the patch above probably cannot be omitted.
With FEAT_GUI, CSI is just an ordinary character, so removing the #ifdef FEAT_GUI can cause problems like treating a part of a UTF-8 sequence as a part of a GUI termcap when FEAT_GUI is not defined.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Note: unlike a previous issue, the #ifdef FEAT_GUI in the patch above probably cannot be omitted.
Without FEAT_GUI, CSI is just an ordinary character, so removing the #ifdef FEAT_GUI can cause problems like treating a part of a UTF-8 sequence as a part of a GUI termcap when FEAT_GUI is not defined.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I guess the easiest way to test this is to just hardcode the register content. I've create a PR #11275.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #11270 as completed via 2cd0f27.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Fix works for me on 9.0.662. It even correctly plays macros recorded on 9.0.636.
Thanks @zeertzjq!
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()