diff src/testdir/test_help.vim @ 28688:264fa41e6704 v8.2.4868

patch 8.2.4868: when closing help window autocmds triggered for wrong window Commit: https://github.com/vim/vim/commit/2a2707d03337d0bb7d5fd1770238809618653d4a Author: LemonBoy <thatlemon@gmail.com> Date: Wed May 4 22:13:47 2022 +0100 patch 8.2.4868: when closing help window autocmds triggered for wrong window Problem: When closing help window autocmds triggered for the wrong window. Solution: Figure out the new current window earlier. (closes https://github.com/vim/vim/issues/10348)
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 May 2022 23:15:02 +0200
parents 6ba17bf0f86a
children af4ffc4b2a26
line wrap: on
line diff
--- a/src/testdir/test_help.vim
+++ b/src/testdir/test_help.vim
@@ -12,6 +12,30 @@ func Test_help_restore_snapshot()
   helpclose
 endfunc
 
+func Test_help_restore_snapshot_split()
+  " Squeeze the unnamed buffer, Xfoo and the help one side-by-side and focus
+  " the first one before calling :help.
+  let bnr = bufnr()
+  botright vsp Xfoo
+  wincmd h
+  help
+  wincmd L
+  let g:did_bufenter = v:false
+  augroup T
+    au!
+    au BufEnter Xfoo let g:did_bufenter = v:true
+  augroup END
+  helpclose
+  augroup! T
+  " We're back to the unnamed buffer.
+  call assert_equal(bnr, bufnr())
+  " No BufEnter was triggered for Xfoo.
+  call assert_equal(v:false, g:did_bufenter)
+
+  close!
+  bwipe!
+endfunc
+
 func Test_help_errors()
   call assert_fails('help doesnotexist', 'E149:')
   call assert_fails('help!', 'E478:')