Mercurial > vim
comparison src/testdir/test_visual.vim @ 19625:f70a3c1000bb v8.2.0369
patch 8.2.0369: various Normal mode commands not fully tested
Commit: https://github.com/vim/vim/commit/1671f4488105ee12a6a8558ae351436c26ab55fc
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 10 07:48:13 2020 +0100
patch 8.2.0369: various Normal mode commands not fully tested
Problem: Various Normal mode commands not fully tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5751)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 10 Mar 2020 08:00:06 +0100 |
parents | 9c15be376631 |
children | 0208534b8a84 |
comparison
equal
deleted
inserted
replaced
19624:ce4838c19ca1 | 19625:f70a3c1000bb |
---|---|
155 exe "norm! 10i.\<Esc>Y4P3lj\<C-V>4l2jr " | 155 exe "norm! 10i.\<Esc>Y4P3lj\<C-V>4l2jr " |
156 exe "norm! gvO\<Esc>ra" | 156 exe "norm! gvO\<Esc>ra" |
157 exe "norm! gvO\<Esc>rb" | 157 exe "norm! gvO\<Esc>rb" |
158 exe "norm! gvo\<C-c>rc" | 158 exe "norm! gvo\<C-c>rc" |
159 exe "norm! gvO\<C-c>rd" | 159 exe "norm! gvO\<C-c>rd" |
160 set selection=exclusive | |
161 exe "norm! gvOo\<C-c>re" | |
162 call assert_equal('...a be.', getline(4)) | |
163 exe "norm! gvOO\<C-c>rf" | |
164 set selection& | |
160 | 165 |
161 call assert_equal(['..........', | 166 call assert_equal(['..........', |
162 \ '...c d..', | 167 \ '...c d..', |
163 \ '... ..', | 168 \ '... ..', |
164 \ '...a b..', | 169 \ '...a bf.', |
165 \ '..........'], getline(1, '$')) | 170 \ '..........'], getline(1, '$')) |
166 | 171 |
167 enew! | 172 enew! |
168 endfun | 173 endfun |
169 | 174 |
643 call deletebufline('', 1, '$') | 648 call deletebufline('', 1, '$') |
644 call append('$', ['a', 'b', 'c']) | 649 call append('$', ['a', 'b', 'c']) |
645 exe "normal Gkgh\<Down>\<End>\<Del>" | 650 exe "normal Gkgh\<Down>\<End>\<Del>" |
646 call assert_equal(['', 'a', ''], getline(1, '$')) | 651 call assert_equal(['', 'a', ''], getline(1, '$')) |
647 | 652 |
653 " CTRL-H in select mode behaves like 'x' | |
654 call setline(1, 'abcdef') | |
655 exe "normal! gggh\<Right>\<Right>\<Right>\<C-H>" | |
656 call assert_equal('ef', getline(1)) | |
657 | |
658 " CTRL-O in select mode switches to visual mode for one command | |
659 call setline(1, 'abcdef') | |
660 exe "normal! gggh\<C-O>3lm" | |
661 call assert_equal('mef', getline(1)) | |
662 | |
648 sunmap <lt>End> | 663 sunmap <lt>End> |
649 sunmap <lt>Down> | 664 sunmap <lt>Down> |
650 sunmap <lt>Del> | 665 sunmap <lt>Del> |
651 bwipe! | 666 bwipe! |
652 endfunc | 667 endfunc |
750 | 765 |
751 " Tests for the visual block mode commands | 766 " Tests for the visual block mode commands |
752 func Test_visual_block_mode() | 767 func Test_visual_block_mode() |
753 new | 768 new |
754 call append(0, '') | 769 call append(0, '') |
755 call setline(1, ['abcdefghijklm', 'abcdefghijklm', 'abcdefghijklm', | 770 call setline(1, repeat(['abcdefghijklm'], 5)) |
756 \ 'abcdefghijklm', 'abcdefghijklm']) | |
757 call cursor(1, 1) | 771 call cursor(1, 1) |
758 | 772 |
759 " Test shift-right of a block | 773 " Test shift-right of a block |
760 exe "normal jllll\<C-V>jj>wll\<C-V>jlll>" | 774 exe "normal jllll\<C-V>jj>wll\<C-V>jlll>" |
761 " Test shift-left of a block | 775 " Test shift-left of a block |
770 \ 'axyzqqqq mno ghijklm', | 784 \ 'axyzqqqq mno ghijklm', |
771 \ 'axyzqqqqef mno ghijklm', | 785 \ 'axyzqqqqef mno ghijklm', |
772 \ 'axyzqqqqefgmnoklm', | 786 \ 'axyzqqqqefgmnoklm', |
773 \ 'abcdqqqqijklm'], getline(1, 5)) | 787 \ 'abcdqqqqijklm'], getline(1, 5)) |
774 | 788 |
789 " Test 'C' to change till the end of the line | |
790 call cursor(3, 4) | |
791 exe "normal! \<C-V>j3lCooo" | |
792 call assert_equal(['axyooo', 'axyooo'], getline(3, 4)) | |
793 | |
794 " Test 'D' to delete till the end of the line | |
795 call cursor(3, 3) | |
796 exe "normal! \<C-V>j2lD" | |
797 call assert_equal(['ax', 'ax'], getline(3, 4)) | |
798 | |
775 bwipe! | 799 bwipe! |
776 endfunc | 800 endfunc |
777 | 801 |
778 " Test block-insert using cursor keys for movement | 802 " Test block-insert using cursor keys for movement |
779 func Test_visual_block_insert_cursor_keys() | 803 func Test_visual_block_insert_cursor_keys() |
956 set virtualedit& | 980 set virtualedit& |
957 set selection& | 981 set selection& |
958 close! | 982 close! |
959 endfunc | 983 endfunc |
960 | 984 |
961 " Test for starting visual mode with a count | 985 " Test for starting visual mode with a count. |
962 " This test should be run withou any previous visual modes. So this should be | 986 " This test should be run without any previous visual modes. So this should be |
963 " run as a first test. | 987 " run as a first test. |
964 func Test_AAA_start_visual_mode_with_count() | 988 func Test_AAA_start_visual_mode_with_count() |
965 new | 989 new |
966 call setline(1, ['aaaaaaa', 'aaaaaaa', 'aaaaaaa', 'aaaaaaa']) | 990 call setline(1, ['aaaaaaa', 'aaaaaaa', 'aaaaaaa', 'aaaaaaa']) |
967 normal! gg2Vy | 991 normal! gg2Vy |