]> granicus.if.org Git - vim/commitdiff
patch 8.0.1789: BufWinEnter does not work well for a terminal window v8.0.1789
authorBram Moolenaar <Bram@vim.org>
Thu, 3 May 2018 18:40:20 +0000 (20:40 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 3 May 2018 18:40:20 +0000 (20:40 +0200)
Problem:    BufWinEnter does not work well for a terminal window.
Solution:   Do not trigger BufWinEnter when opening a terminal window.

runtime/doc/autocmd.txt
src/terminal.c
src/testdir/test_terminal.vim
src/version.c

index c3f04cc7aadf8df90d9475fd092bfb46ce1ab587..14cf6c42a59bf9750480f9500f7863e1e45e3234 100644 (file)
@@ -469,6 +469,9 @@ BufWinEnter                 After a buffer is displayed in a window.  This
                                existing buffer.  But it does happen for a
                                ":split" with the name of the current buffer,
                                since it reloads that buffer.
+                               Does not happen for a terminal window, because
+                               it starts in Terminal-Job mode and Normal mode
+                               commands won't work. Use |TerminalOpen| instead.
                                                        *BufWinLeave*
 BufWinLeave                    Before a buffer is removed from a window.
                                Not when it's still visible in another window.
index 1fd9ed2abcc93b14bfff3ed38e0718b52eb4771a..56e08db50f2b568164807f58040e395bace8b2b4 100644 (file)
@@ -605,13 +605,7 @@ term_start(
         * a deadlock if the job is waiting for Vim to read. */
        channel_set_nonblock(term->tl_job->jv_channel, PART_IN);
 
-       if (old_curbuf == NULL)
-       {
-           ++curbuf->b_locked;
-           apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf);
-           --curbuf->b_locked;
-       }
-       else
+       if (old_curbuf != NULL)
        {
            --curbuf->b_nwindows;
            curbuf = old_curbuf;
index cde41a1d653adc0341f9e35ecdaaec075e8b8ee1..8b63dee4eec891cededf162cbfb6a3519161df68 100644 (file)
@@ -32,7 +32,7 @@ func Run_shell_in_terminal(options)
 endfunc
 
 func Test_terminal_basic()
-  au BufWinEnter * if &buftype == 'terminal' | let b:done = 'yes' | endif
+  au TerminalOpen * let b:done = 'yes'
   let buf = Run_shell_in_terminal({})
 
   if has("unix")
@@ -61,7 +61,7 @@ func Test_terminal_basic()
   close
   call assert_equal("", bufname(buf))
 
-  au! BufWinEnter
+  au! TerminalOpen
   unlet g:job
 endfunc
 
index d933e811e8df1cd32abf7ff75e3ee91e518da335..9d00e46c8a32d1d51959a783efbef660a1c54774 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1789,
 /**/
     1788,
 /**/