Patch 8.2.1772
Problem: Cannot use CTRL-W <Down> to move out of a terminal window.
Solution: Use special_to_buf() instead of mb_char2bytes(). (closes #7045)
Files: src/terminal.c, src/testdir/test_terminal.vim
*** ../vim-8.2.1771/src/terminal.c 2020-09-11 22:10:17.965597366 +0200
--- src/terminal.c 2020-09-29 21:15:54.602713305 +0200
***************
*** 2640,2651 ****
}
else if (termwinkey == 0 || c != termwinkey)
{
! char_u buf[MB_MAXBYTES + 2];
// Put the command into the typeahead buffer, when using the
// stuff buffer KeyStuffed is set and 'langmap' won't be used.
buf[0] = Ctrl_W;
! buf[(*mb_char2bytes)(c, buf + 1) + 1] = NUL;
ins_typebuf(buf, REMAP_NONE, 0, TRUE, FALSE);
ret = OK;
goto theend;
--- 2640,2652 ----
}
else if (termwinkey == 0 || c != termwinkey)
{
! // space for CTRL-W, modifier, multi-byte char and NUL
! char_u buf[1 + 3 + MB_MAXBYTES + 1];
// Put the command into the typeahead buffer, when using the
// stuff buffer KeyStuffed is set and 'langmap' won't be used.
buf[0] = Ctrl_W;
! buf[special_to_buf(c, mod_mask, FALSE, buf + 1) + 1] = NUL;
ins_typebuf(buf, REMAP_NONE, 0, TRUE, FALSE);
ret = OK;
goto theend;
*** ../vim-8.2.1771/src/testdir/test_terminal.vim 2020-09-06
21:12:56.621232486 +0200
--- src/testdir/test_terminal.vim 2020-09-29 21:22:36.997577007 +0200
***************
*** 1379,1384 ****
--- 1379,1401 ----
set statusline=
endfunc
+ func Test_terminal_window_focus()
+ let winid1 = win_getid()
+ terminal
+ let winid2 = win_getid()
+ call feedkeys("\<C-W>j", 'xt')
+ call assert_equal(winid1, win_getid())
+ call feedkeys("\<C-W>k", 'xt')
+ call assert_equal(winid2, win_getid())
+ " can use a cursor key here
+ call feedkeys("\<C-W>\<Down>", 'xt')
+ call assert_equal(winid1, win_getid())
+ call feedkeys("\<C-W>\<Up>", 'xt')
+ call assert_equal(winid2, win_getid())
+
+ bwipe!
+ endfunc
+
func Api_drop_common(options)
call assert_equal(1, winnr('$'))
*** ../vim-8.2.1771/src/version.c 2020-09-29 20:59:13.561602886 +0200
--- src/version.c 2020-09-29 21:23:09.401485692 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1772,
/**/
--
When a fly lands on the ceiling, does it do a half roll or
a half loop?
/// 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202009291924.08TJOFNo769047%40masaka.moolenaar.net.