diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-05-03 20:40:20 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-05-03 20:40:20 +0200 |
commit | 606cb8b08ed510962fcdc8ef1abcc1fe35fbffef (patch) | |
tree | 1de16674e2bd1fd2293dd1f3025a6074d2ce35f7 | |
parent | dddab90d22d5f8be9c6751505339397ca5742831 (diff) | |
download | vim-git-606cb8b08ed510962fcdc8ef1abcc1fe35fbffef.tar.gz |
patch 8.0.1789: BufWinEnter does not work well for a terminal windowv8.0.1789
Problem: BufWinEnter does not work well for a terminal window.
Solution: Do not trigger BufWinEnter when opening a terminal window.
-rw-r--r-- | runtime/doc/autocmd.txt | 3 | ||||
-rw-r--r-- | src/terminal.c | 8 | ||||
-rw-r--r-- | src/testdir/test_terminal.vim | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index c3f04cc7a..14cf6c42a 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -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. diff --git a/src/terminal.c b/src/terminal.c index 1fd9ed2ab..56e08db50 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -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; diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index cde41a1d6..8b63dee4e 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -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 diff --git a/src/version.c b/src/version.c index d933e811e..9d00e46c8 100644 --- a/src/version.c +++ b/src/version.c @@ -762,6 +762,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1789, +/**/ 1788, /**/ 1787, |