Mercurial > vim
changeset 22882:be7f52838056 v8.2.1988
patch 8.2.1988: still in Insert mode when opening terminal popup
Commit: https://github.com/vim/vim/commit/e41decc892a115335259096c3bc0204dd99b372b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 14 21:34:59 2020 +0100
patch 8.2.1988: still in Insert mode when opening terminal popup
Problem: Still in Insert mode when opening terminal popup with a <Cmd>
mapping in Insert mode.
Solution: Exit Insert mode. (closes #7295)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 14 Nov 2020 21:45:04 +0100 |
parents | 29eccb06e5a2 |
children | f786ab06aee7 |
files | src/edit.c src/testdir/test_terminal.vim src/version.c |
diffstat | 3 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/edit.c +++ b/src/edit.c @@ -1033,6 +1033,11 @@ doESCkey: case K_COMMAND: // <Cmd>command<CR> do_cmdline(NULL, getcmdkeycmd, NULL, 0); +#ifdef FEAT_TERMINAL + if (term_use_loop()) + // Started a terminal that gets the input, exit Insert mode. + goto doESCkey; +#endif break; case K_CURSORHOLD: // Didn't type something for a while.
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -1237,6 +1237,24 @@ func Test_terminal_popup_with_cmd() unlet s:winid endfunc +func Test_terminal_popup_insert_cmd() + CheckUnix + + inoremap <F3> <Cmd>call StartTermInPopup()<CR> + func StartTermInPopup() + call term_start(['/bin/sh', '-c', 'cat'], #{hidden: v:true})->popup_create(#{highlight: 'Pmenu'}) + endfunc + call feedkeys("i\<F3>") + sleep 10m + call assert_equal('n', mode()) + + call feedkeys("\<C-D>", 'xt') + sleep 20m + call feedkeys(":q\<CR>", 'xt') + delfunc StartTermInPopup + iunmap <F3> +endfunc + func Check_dump01(off) call assert_equal('one two three four five', trim(getline(a:off + 1))) call assert_equal('~ Select Word', trim(getline(a:off + 7)))