Mercurial > vim
comparison src/testdir/test_autocmd.vim @ 29505:33983b2f030f v9.0.0094
patch 9.0.0094: cursor restored unexpected with nested autocommand
Commit: https://github.com/vim/vim/commit/3d6ee8bda0550a01346f5992bbce09c0eb6d7569
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 27 15:23:35 2022 +0100
patch 9.0.0094: cursor restored unexpected with nested autocommand
Problem: Cursor restored unexpected with nested autocommand.
Solution: Do not restore the cursor when it was moved intentionally.
(closes #10780)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 27 Jul 2022 16:30:03 +0200 |
parents | 2a327999c05c |
children | 6eaef7375f17 |
comparison
equal
deleted
inserted
replaced
29504:44ffb6bf2b55 | 29505:33983b2f030f |
---|---|
2316 augroup nested_inv | 2316 augroup nested_inv |
2317 au! | 2317 au! |
2318 augroup END | 2318 augroup END |
2319 set laststatus& | 2319 set laststatus& |
2320 cclose | 2320 cclose |
2321 bwipe! | |
2322 endfunc | |
2323 | |
2324 func Test_autocmd_nested_keeps_cursor_pos() | |
2325 enew | |
2326 call setline(1, 'foo') | |
2327 autocmd User foo ++nested normal! $a | |
2328 autocmd InsertLeave * : | |
2329 doautocmd User foo | |
2330 call assert_equal([0, 1, 3, 0], getpos('.')) | |
2331 | |
2321 bwipe! | 2332 bwipe! |
2322 endfunc | 2333 endfunc |
2323 | 2334 |
2324 func Test_autocmd_nested_switch_window() | 2335 func Test_autocmd_nested_switch_window() |
2325 " run this in a separate Vim so that SafeState works | 2336 " run this in a separate Vim so that SafeState works |