diff src/testdir/test_functions.vim @ 31890:2d96d7f9da7e v9.0.1277

patch 9.0.1277: cursor may move with autocmd in Visual mode Commit: https://github.com/vim/vim/commit/49f0524fb575bb1cf4881e472afab7d37c579440 Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Feb 4 10:58:34 2023 +0000 patch 9.0.1277: cursor may move with autocmd in Visual mode Problem: Cursor may move with autocmd in Visual mode. Solution: Restore "VIsual_active" before calling check_cursor(). (closes #11939)
author Bram Moolenaar <Bram@vim.org>
date Sat, 04 Feb 2023 12:00:05 +0100
parents db09821e1372
children 8d6f53a07ffd
line wrap: on
line diff
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1648,7 +1648,7 @@ endfunc
 
 func Test_setbufvar_options()
   " This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the
-  " window layout.
+  " window layout and cursor position.
   call assert_equal(1, winnr('$'))
   split dummy_preview
   resize 2
@@ -1662,11 +1662,20 @@ func Test_setbufvar_options()
   execute 'belowright vertical split #' . dummy_buf
   call assert_equal(wh, winheight(0))
   let dum1_id = win_getid()
+  call setline(1, 'foo')
+  normal! V$
+  call assert_equal(4, col('.'))
+  call setbufvar('dummy_preview', '&buftype', 'nofile')
+  call assert_equal(4, col('.'))
 
   wincmd h
   let wh = winheight(0)
+  call setline(1, 'foo')
+  normal! V$
+  call assert_equal(4, col('.'))
   let dummy_buf = bufnr('dummy_buf2', v:true)
   eval 'nofile'->setbufvar(dummy_buf, '&buftype')
+  call assert_equal(4, col('.'))
   execute 'belowright vertical split #' . dummy_buf
   call assert_equal(wh, winheight(0))