robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
1763eddede
master
1" Tests for not changing curswant 2 3source check.vim 4source term_util.vim 5 6func Test_curswant () 7new 8call append ( 0 , [ '1234567890' , '12345' ]) 9 10normal ! ggf8j 11call assert_equal ( 7 , winsaveview (). curswant ) 12let & tabstop =& tabstop 13call assert_equal ( 4 , winsaveview (). curswant ) 14 15normal ! ggf8j 16call assert_equal ( 7 , winsaveview (). curswant ) 17let & timeoutlen =& timeoutlen 18call assert_equal ( 7 , winsaveview (). curswant ) 19 20normal ! ggf8j 21call assert_equal ( 7 , winsaveview (). curswant ) 22let & ttimeoutlen =& ttimeoutlen 23call assert_equal ( 7 , winsaveview (). curswant ) 24 25bw ! 26endfunc 27 28func Test_normal_gm () 29CheckRunVimInTerminal 30let lines =<< trim END 31call setline(1, repeat([" abcd\tefgh\tij"], 10)) 32call cursor(1, 1) 33END 34call writefile ( lines , 'XtestCurswant' , 'D' ) 35let buf = RunVimInTerminal ( '-S XtestCurswant' , #{ rows : 10 }) 36if has ( "folding" ) 37call term_sendkeys ( buf , "jVjzf" ) 38" gm 39call term_sendkeys ( buf , "gmk" ) 40call term_sendkeys ( buf , ":echo virtcol('.')\<cr>" ) 41call WaitFor ({ ->term_getline ( buf , 10 ) =~ '^18\s\+' }) 42" g0 43call term_sendkeys ( buf , "jg0k" ) 44call term_sendkeys ( buf , ":echo virtcol('.')\<cr>" ) 45call WaitFor ({ ->term_getline ( buf , 10 ) =~ '^1\s\+' }) 46" g^ 47call term_sendkeys ( buf , "jg^k" ) 48call term_sendkeys ( buf , ":echo virtcol('.')\<cr>" ) 49call WaitFor ({ ->term_getline ( buf , 10 ) =~ '^3\s\+' }) 50endif 51call term_sendkeys ( buf , ":call cursor(10, 1)\<cr>" ) 52" gm 53call term_sendkeys ( buf , "gmk" ) 54call term_sendkeys ( buf , ":echo virtcol('.')\<cr>" ) 55call term_wait ( buf ) 56call WaitFor ({ ->term_getline ( buf , 10 ) =~ '^18\s\+' }) 57" g0 58call term_sendkeys ( buf , "g0k" ) 59call term_sendkeys ( buf , ":echo virtcol('.')\<cr>" ) 60call WaitFor ({ ->term_getline ( buf , 10 ) =~ '^1\s\+' }) 61" g^ 62call term_sendkeys ( buf , "g^k" ) 63call term_sendkeys ( buf , ":echo virtcol('.')\<cr>" ) 64call WaitFor ({ ->term_getline ( buf , 10 ) =~ '^3\s\+' }) 65" clean up 66call StopVimInTerminal ( buf ) 67wincmd p 68wincmd c 69endfunc 70 71" vim: shiftwidth=2 sts=2 expandtab