@@ -20,16 +20,35 @@ func Test_move_cursor()
2020 call assert_equal ([4 , 3 , 0 , 3 ], getcurpos ()[1 :])
2121
2222 call cursor (2 , 2 )
23- call assert_equal ([2 , 2 , 0 , 3 ], getcurpos ()[1 :])
23+ call assert_equal ([2 , 2 , 0 , 2 ], getcurpos ()[1 :])
2424 " line number zero keeps the line number
2525 call cursor (0 , 1 )
26- call assert_equal ([2 , 1 , 0 , 3 ], getcurpos ()[1 :])
26+ call assert_equal ([2 , 1 , 0 , 1 ], getcurpos ()[1 :])
2727 " col number zero keeps the column
2828 call cursor (3 , 0 )
29- call assert_equal ([3 , 1 , 0 , 3 ], getcurpos ()[1 :])
29+ call assert_equal ([3 , 1 , 0 , 1 ], getcurpos ()[1 :])
3030 " below last line goes to last line
3131 call cursor (9 , 1 )
32- call assert_equal ([4 , 1 , 0 , 3 ], getcurpos ()[1 :])
32+ call assert_equal ([4 , 1 , 0 , 1 ], getcurpos ()[1 :])
3333
3434 quit !
3535endfunc
36+
37+ " Very short version of what matchparen does.
38+ function s: Highlight_Matching_Pair ()
39+ let save_cursor = getcurpos ()
40+ call setpos (' .' , save_cursor)
41+ endfunc
42+
43+ func Test_curswant_with_autocommand ()
44+ new
45+ call setline (1 , [' func()' , ' {' , ' }' , ' ----' ])
46+ autocmd ! CursorMovedI * call s: Highlight_Matching_Pair ()
47+ call disable_char_avail_for_testing (1 )
48+ exe " normal! 3Ga\<Down> X\<Esc> "
49+ call disable_char_avail_for_testing (0 )
50+ call assert_equal (' -X---' , getline (4 ))
51+ autocmd ! CursorMovedI *
52+ quit !
53+ endfunc
54+
0 commit comments