To: vim_dev@googlegroups.com Subject: Patch 8.0.1789 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1789 Problem: BufWinEnter does not work well for a terminal window. Solution: Do not trigger BufWinEnter when opening a terminal window. Files: src/terminal.c, runtime/doc/autocmd.txt, src/testdir/test_terminal.vim *** ../vim-8.0.1788/src/terminal.c 2018-05-01 18:47:52.984188506 +0200 --- src/terminal.c 2018-05-03 20:33:42.380892412 +0200 *************** *** 605,617 **** * 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 { --curbuf->b_nwindows; curbuf = old_curbuf; --- 605,611 ---- * 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_nwindows; curbuf = old_curbuf; *** ../vim-8.0.1788/runtime/doc/autocmd.txt 2018-03-11 16:55:30.004616458 +0100 --- runtime/doc/autocmd.txt 2018-05-03 20:32:24.045465616 +0200 *************** *** 448,453 **** --- 469,477 ---- 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. *** ../vim-8.0.1788/src/testdir/test_terminal.vim 2018-05-01 18:47:52.984188506 +0200 --- src/testdir/test_terminal.vim 2018-05-03 20:34:52.504388841 +0200 *************** *** 32,38 **** endfunc func Test_terminal_basic() ! au BufWinEnter * if &buftype == 'terminal' | let b:done = 'yes' | endif let buf = Run_shell_in_terminal({}) if has("unix") --- 32,38 ---- endfunc func Test_terminal_basic() ! au TerminalOpen * let b:done = 'yes' let buf = Run_shell_in_terminal({}) if has("unix") *************** *** 61,67 **** close call assert_equal("", bufname(buf)) ! au! BufWinEnter unlet g:job endfunc --- 61,67 ---- close call assert_equal("", bufname(buf)) ! au! TerminalOpen unlet g:job endfunc *** ../vim-8.0.1788/src/version.c 2018-05-02 22:00:12.567590266 +0200 --- src/version.c 2018-05-03 20:33:31.236973234 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1789, /**/ -- You know you use Vim too much when you have this alias in your ~/.bashrc file: alias :e=/bin/vim (Eljay Love-Jensen) /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///