Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
31889:56fd2c6e8425 | 31890:2d96d7f9da7e |
---|---|
1646 endif | 1646 endif |
1647 endfunc | 1647 endfunc |
1648 | 1648 |
1649 func Test_setbufvar_options() | 1649 func Test_setbufvar_options() |
1650 " This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the | 1650 " This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the |
1651 " window layout. | 1651 " window layout and cursor position. |
1652 call assert_equal(1, winnr('$')) | 1652 call assert_equal(1, winnr('$')) |
1653 split dummy_preview | 1653 split dummy_preview |
1654 resize 2 | 1654 resize 2 |
1655 set winfixheight winfixwidth | 1655 set winfixheight winfixwidth |
1656 let prev_id = win_getid() | 1656 let prev_id = win_getid() |
1660 let dummy_buf = bufnr('dummy_buf1', v:true) | 1660 let dummy_buf = bufnr('dummy_buf1', v:true) |
1661 call setbufvar(dummy_buf, '&buftype', 'nofile') | 1661 call setbufvar(dummy_buf, '&buftype', 'nofile') |
1662 execute 'belowright vertical split #' . dummy_buf | 1662 execute 'belowright vertical split #' . dummy_buf |
1663 call assert_equal(wh, winheight(0)) | 1663 call assert_equal(wh, winheight(0)) |
1664 let dum1_id = win_getid() | 1664 let dum1_id = win_getid() |
1665 call setline(1, 'foo') | |
1666 normal! V$ | |
1667 call assert_equal(4, col('.')) | |
1668 call setbufvar('dummy_preview', '&buftype', 'nofile') | |
1669 call assert_equal(4, col('.')) | |
1665 | 1670 |
1666 wincmd h | 1671 wincmd h |
1667 let wh = winheight(0) | 1672 let wh = winheight(0) |
1673 call setline(1, 'foo') | |
1674 normal! V$ | |
1675 call assert_equal(4, col('.')) | |
1668 let dummy_buf = bufnr('dummy_buf2', v:true) | 1676 let dummy_buf = bufnr('dummy_buf2', v:true) |
1669 eval 'nofile'->setbufvar(dummy_buf, '&buftype') | 1677 eval 'nofile'->setbufvar(dummy_buf, '&buftype') |
1678 call assert_equal(4, col('.')) | |
1670 execute 'belowright vertical split #' . dummy_buf | 1679 execute 'belowright vertical split #' . dummy_buf |
1671 call assert_equal(wh, winheight(0)) | 1680 call assert_equal(wh, winheight(0)) |
1672 | 1681 |
1673 bwipe! | 1682 bwipe! |
1674 call win_gotoid(prev_id) | 1683 call win_gotoid(prev_id) |