diff src/testdir/test_window_cmd.vim @ 15241:83ff85896a14 v8.1.0630

patch 8.1.0630: "wincmd p" does not work after using an autocmd window commit https://github.com/vim/vim/commit/a42df5934bdc1178ed2ee8cb9c8686975b578497 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 24 00:22:39 2018 +0100 patch 8.1.0630: "wincmd p" does not work after using an autocmd window Problem: "wincmd p" does not work after using an autocmd window. Solution: Store "prevwin" in aco_save_T. (Christian Brabandt, closes https://github.com/vim/vim/issues/3690)
author Bram Moolenaar <Bram@vim.org>
date Mon, 24 Dec 2018 00:30:07 +0100
parents cc4c41448d77
children 63b02fcf1361
line wrap: on
line diff
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -578,4 +578,41 @@ func Test_winrestcmd()
   only
 endfunc
 
+function! Fun_RenewFile()
+  sleep 2
+  silent execute '!echo "1" > tmp.txt'
+  sp
+  wincmd p
+  edit! tmp.txt
+endfunction
+
+func Test_window_prevwin()
+  " Can we make this work on MS-Windows?
+  if !has('unix')
+    return
+  endif
+
+  set hidden autoread
+  call writefile(['2'], 'tmp.txt')
+  new tmp.txt
+  q
+  " Need to wait a bit for the timestamp to be older.
+  call Fun_RenewFile()
+  call assert_equal(2, winnr())
+  wincmd p
+  call assert_equal(1, winnr())
+  wincmd p
+  q
+  call Fun_RenewFile()
+  call assert_equal(2, winnr())
+  wincmd p
+  call assert_equal(1, winnr())
+  wincmd p
+  " reset
+  q
+  call delete('tmp.txt')
+  set hidden&vim autoread&vim
+  delfunc Fun_RenewFile
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab