aboutsummaryrefslogtreecommitdiff
path: root/test/old
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-06-21 06:29:13 +0800
committerzeertzjq <zeertzjq@outlook.com>2024-06-21 14:10:30 +0800
commit86ea42ce265a5a9df2843b04e8036268593825b9 (patch)
treeaeb0c21e36ed60535ecd5fe094d3d43016cf9786 /test/old
parent26c2a56d99f9435d6a32e42c9508cafc37ab7d72 (diff)
downloadrneovim-86ea42ce265a5a9df2843b04e8036268593825b9.tar.gz
rneovim-86ea42ce265a5a9df2843b04e8036268593825b9.tar.bz2
rneovim-86ea42ce265a5a9df2843b04e8036268593825b9.zip
vim-patch:9.1.0507: hard to detect cursor movement in the command line
Problem: hard to detect cursor movement in the command line Solution: Add the CursorMovedC autocommand (Shougo Matsushita) closes: vim/vim#15040 https://github.com/vim/vim/commit/d09521476f41dd8dbddb25b7acd0b299f9bf94d3 Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Diffstat (limited to 'test/old')
-rw-r--r--test/old/testdir/test_autocmd.vim15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim
index cdcd68f3d6..9132e0fdce 100644
--- a/test/old/testdir/test_autocmd.vim
+++ b/test/old/testdir/test_autocmd.vim
@@ -2010,6 +2010,21 @@ func Test_Cmdline()
au! CmdlineEnter
au! CmdlineLeave
let &shellslash = save_shellslash
+
+ au! CursorMovedC : let g:pos = getcmdpos()
+ let g:pos = 0
+ call feedkeys(":hello\<Left>\<ESC>", 'xt')
+ call assert_equal(5, g:pos)
+ call feedkeys(":12345678\<C-R>=setcmdpos(3)\<CR>\<ESC>", 'xt')
+ call assert_equal(3, g:pos)
+ au! CursorMovedC
+
+ " CursorMovedC changes the cursor position.
+ au! CursorMovedC : let g:pos = getcmdpos() | call setcmdpos(getcmdpos()-1)
+ let g:pos = 0
+ call feedkeys(":hello\<Left>\<ESC>", 'xt')
+ call assert_equal(5, g:pos)
+ au! CursorMovedC
endfunc
" Test for BufWritePre autocommand that deletes or unloads the buffer.