Patch 8.2.0604
Problem:    :startinsert in a terminal window used later.
Solution:   Ignore :startinsert in a terminal window. (closes #5952)
Files:      src/ex_docmd.c, src/testdir/test_terminal.vim


*** ../vim-8.2.0603/src/ex_docmd.c      2020-04-18 19:53:24.531912284 +0200
--- src/ex_docmd.c      2020-04-19 18:11:00.362492672 +0200
***************
*** 7750,7755 ****
--- 7750,7760 ----
            curwin->w_cursor.lnum = 1;
        set_cursor_for_append_to_line();
      }
+ #ifdef FEAT_TERMINAL
+     // Ignore this when running in an active terminal.
+     if (term_job_running(curbuf->b_term))
+       return;
+ #endif
  
      // Ignore the command when already in Insert mode.  Inserting an
      // expression register that invokes a function can do this.
*** ../vim-8.2.0603/src/testdir/test_terminal.vim       2020-04-11 
17:09:28.324426586 +0200
--- src/testdir/test_terminal.vim       2020-04-19 18:07:32.963072828 +0200
***************
*** 2612,2615 ****
--- 2612,2637 ----
    set hidden&
  endfunc
  
+ func Test_term_and_startinsert()
+   CheckRunVimInTerminal
+   CheckUnix
+ 
+   let lines =<< trim EOL
+      put='some text'
+      term
+      startinsert
+   EOL
+   call writefile(lines, 'XTest_startinsert')
+   let buf = RunVimInTerminal('-S XTest_startinsert', {})
+ 
+   call term_sendkeys(buf, "exit\r")
+   call WaitForAssert({-> assert_equal("some text", term_getline(buf, 1))})
+   call term_sendkeys(buf, "0l")
+   call term_sendkeys(buf, "A<\<Esc>")
+   call WaitForAssert({-> assert_equal("some text<", term_getline(buf, 1))})
+ 
+   call StopVimInTerminal(buf)
+   call delete('XTest_startinsert')
+ endfunc
+ 
  " vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.0603/src/version.c       2020-04-19 17:46:49.506625342 +0200
--- src/version.c       2020-04-19 18:11:38.514388708 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     604,
  /**/

-- 
The budget process was invented by an alien race of sadistic beings who
resemble large cats.
                                (Scott Adams - The Dilbert principle)

 /// 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/202004191613.03JGDgWd006809%40masaka.moolenaar.net.

Raspunde prin e-mail lui