Patch 8.2.1988
Problem:    Still in Insert mode when opening terminal popup with a <Cmd>
            mapping in Insert mode.
Solution:   Exit Insert mode. (closes #7295)
Files:      src/edit.c, src/testdir/test_terminal.vim


*** ../vim-8.2.1987/src/edit.c  2020-11-12 14:20:32.017927303 +0100
--- src/edit.c  2020-11-14 21:33:09.181631482 +0100
***************
*** 1033,1038 ****
--- 1033,1043 ----
  
        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.
*** ../vim-8.2.1987/src/testdir/test_terminal.vim       2020-11-14 
20:21:51.361723986 +0100
--- src/testdir/test_terminal.vim       2020-11-14 21:32:20.917734754 +0100
***************
*** 1237,1242 ****
--- 1237,1260 ----
    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)))
*** ../vim-8.2.1987/src/version.c       2020-11-14 21:04:29.213262892 +0100
--- src/version.c       2020-11-14 21:28:51.270183411 +0100
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     1988,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
246. You use up your free 1 Gbyte in two days.

 /// 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/202011142034.0AEKYgsO699076%40masaka.moolenaar.net.

Raspunde prin e-mail lui