annotate src/testdir/test_selectmode.vim @ 31738:ad0712119bee v9.0.1201

patch 9.0.1201: assignment with operator doesn't work in object method Commit: https://github.com/vim/vim/commit/4cae845ce32797bcae845aacf740ed865b479f34 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 15 15:51:48 2023 +0000 patch 9.0.1201: assignment with operator doesn't work in object method Problem: Assignment with operator doesn't work in object method. Solution: Handle loading the object member. (closes https://github.com/vim/vim/issues/11820) Add a few more tests.
author Bram Moolenaar <Bram@vim.org>
date Sun, 15 Jan 2023 17:00:04 +0100
parents 93d4ee1e6113
children 9c4ee9389bb4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Test for Select-mode
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " This only works for Unix in a terminal
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 source check.vim
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 CheckNotGui
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 CheckUnix
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 source mouse.vim
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 " Test for select mode
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 func Test_selectmode_basic()
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 new
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 call setline(1, range(1,100))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 50
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 norm! gHy
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 call assert_equal('y51', getline('.'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 call setline(1, range(1,100))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 50
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 exe ":norm! V9jo\<c-g>y"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 call assert_equal('y60', getline('.'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 call setline(1, range(1,100))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 50
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 call feedkeys(":set im\n\<c-o>gHc\<c-o>:set noim\n", 'tx')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 call assert_equal('c51', getline('.'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 " clean up
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 bw!
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 " Test for starting selectmode
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 func Test_selectmode_start()
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 new
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 set selectmode=key keymodel=startsel
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 call setline(1, ['abc', 'def', 'ghi'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 call cursor(1, 4)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 call feedkeys("A\<s-home>start\<esc>", 'txin')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 call assert_equal(['startdef', 'ghi'], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 " start select mode again with gv
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 set selectmode=cmd
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 call feedkeys('gvabc', 'xt')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 call assert_equal('abctdef', getline(1))
20941
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
41 " arrow keys without shift should not start selection
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
42 call feedkeys("A\<Home>\<Right>\<Left>ro", 'xt')
505d97ea54da patch 8.2.1022: various parts of code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19738
diff changeset
43 call assert_equal('roabctdef', getline(1))
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 set selectmode= keymodel=
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 bw!
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 " Test for characterwise select mode
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 func Test_characterwise_select_mode()
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 new
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 " Select mode maps
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 snoremap <lt>End> <End>
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 snoremap <lt>Down> <Down>
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 snoremap <lt>Del> <Del>
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 " characterwise select mode: delete middle line
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call deletebufline('', 1, '$')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 call append('$', ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 exe "normal Gkkgh\<End>\<Del>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 call assert_equal(['', 'b', 'c'], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 " characterwise select mode: delete middle two lines
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 call deletebufline('', 1, '$')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 call append('$', ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 exe "normal Gkkgh\<Down>\<End>\<Del>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 call assert_equal(['', 'c'], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 " characterwise select mode: delete last line
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 call deletebufline('', 1, '$')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 call append('$', ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 exe "normal Ggh\<End>\<Del>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 call assert_equal(['', 'a', 'b', ''], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 " characterwise select mode: delete last two lines
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 call deletebufline('', 1, '$')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 call append('$', ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 exe "normal Gkgh\<Down>\<End>\<Del>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 call assert_equal(['', 'a', ''], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 " CTRL-H in select mode behaves like 'x'
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 call setline(1, 'abcdef')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 exe "normal! gggh\<Right>\<Right>\<Right>\<C-H>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 call assert_equal('ef', getline(1))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 " CTRL-O in select mode switches to visual mode for one command
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 call setline(1, 'abcdef')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 exe "normal! gggh\<C-O>3lm"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 call assert_equal('mef', getline(1))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 sunmap <lt>End>
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 sunmap <lt>Down>
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 sunmap <lt>Del>
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 bwipe!
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 " Test for linewise select mode
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 func Test_linewise_select_mode()
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 new
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 " linewise select mode: delete middle line
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 call append('$', ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 exe "normal GkkgH\<Del>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 call assert_equal(['', 'b', 'c'], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 " linewise select mode: delete middle two lines
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 call deletebufline('', 1, '$')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 call append('$', ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 exe "normal GkkgH\<Down>\<Del>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 call assert_equal(['', 'c'], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 " linewise select mode: delete last line
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 call deletebufline('', 1, '$')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 call append('$', ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 exe "normal GgH\<Del>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 call assert_equal(['', 'a', 'b'], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 " linewise select mode: delete last two lines
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 call deletebufline('', 1, '$')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 call append('$', ['a', 'b', 'c'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 exe "normal GkgH\<Down>\<Del>"
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 call assert_equal(['', 'a'], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 bwipe!
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 " Test for blockwise select mode (g CTRL-H)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 func Test_blockwise_select_mode()
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 new
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 call setline(1, ['foo', 'bar'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 call feedkeys("g\<BS>\<Right>\<Down>mm", 'xt')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 call assert_equal(['mmo', 'mmr'], getline(1, '$'))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 close!
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 " Test for using visual mode maps in select mode
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 func Test_select_mode_map()
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 new
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 vmap <buffer> <F2> 3l
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 call setline(1, 'Test line')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 call feedkeys("gh\<F2>map", 'xt')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 call assert_equal('map line', getline(1))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 vmap <buffer> <F2> ygV
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 call feedkeys("0gh\<Right>\<Right>\<F2>cwabc", 'xt')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 call assert_equal('abc line', getline(1))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 vmap <buffer> <F2> :<C-U>let v=100<CR>
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 call feedkeys("gggh\<Right>\<Right>\<F2>foo", 'xt')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 call assert_equal('foo line', getline(1))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 " reselect the select mode using gv from a visual mode map
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 vmap <buffer> <F2> gv
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 set selectmode=cmd
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 call feedkeys("0gh\<F2>map", 'xt')
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 call assert_equal('map line', getline(1))
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 set selectmode&
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 close!
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 " Test double/triple/quadruple click to start 'select' mode
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 func Test_term_mouse_multiple_clicks_to_select_mode()
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 let save_mouse = &mouse
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 let save_term = &term
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 let save_ttymouse = &ttymouse
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 call test_override('no_query_mouse', 1)
24138
7a2a737dc6ec patch 8.2.2610: mouse click test fails when using remote connection
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
168
7a2a737dc6ec patch 8.2.2610: mouse click test fails when using remote connection
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
169 " 'mousetime' must be sufficiently large, or else the test is flaky when
7a2a737dc6ec patch 8.2.2610: mouse click test fails when using remote connection
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
170 " using a ssh connection with X forwarding; i.e. ssh -X.
7a2a737dc6ec patch 8.2.2610: mouse click test fails when using remote connection
Bram Moolenaar <Bram@vim.org>
parents: 20941
diff changeset
171 set mouse=a term=xterm mousetime=1000
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 set selectmode=mouse
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 new
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 for ttymouse_val in g:Ttymouse_values + g:Ttymouse_dec
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 let msg = 'ttymouse=' .. ttymouse_val
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 exe 'set ttymouse=' .. ttymouse_val
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 " Single-click and drag should 'select' the characters
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 call setline(1, ['foo [foo bar] foo', 'foo'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 call MouseLeftClick(1, 3)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 call assert_equal(0, getcharmod(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 call MouseLeftDrag(1, 13)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 call MouseLeftRelease(1, 13)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 norm! o
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 call assert_equal(['foo foo', 'foo'], getline(1, '$'), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 " Double-click on word should visually 'select' the word.
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 call setline(1, ['foo [foo bar] foo', 'foo'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 call MouseLeftClick(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 call assert_equal(0, getcharmod(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 call MouseLeftRelease(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 call MouseLeftClick(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 call assert_equal(32, getcharmod(), msg) " double-click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 call MouseLeftRelease(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 call assert_equal('s', mode(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 norm! bar
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 call assert_equal(['bar [foo bar] foo', 'foo'], getline(1, '$'), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 " Double-click on opening square bracket should visually
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 " 'select' the whole [foo bar].
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 call setline(1, ['foo [foo bar] foo', 'foo'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 call MouseLeftClick(1, 5)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 call assert_equal(0, getcharmod(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 call MouseLeftRelease(1, 5)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 call MouseLeftClick(1, 5)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 call assert_equal(32, getcharmod(), msg) " double-click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 call MouseLeftRelease(1, 5)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 call assert_equal('s', mode(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 norm! bar
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 call assert_equal(['foo bar foo', 'foo'], getline(1, '$'), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 " To guarantee that the next click is not counted as a triple click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 call MouseRightClick(1, 1)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 call MouseRightRelease(1, 1)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 " Triple-click should visually 'select' the whole line.
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 call setline(1, ['foo [foo bar] foo', 'foo'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 call MouseLeftClick(1, 3)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 call assert_equal(0, getcharmod(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 call MouseLeftRelease(1, 3)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 call MouseLeftClick(1, 3)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 call assert_equal(32, getcharmod(), msg) " double-click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 call MouseLeftRelease(1, 3)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 call MouseLeftClick(1, 3)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 call assert_equal(64, getcharmod(), msg) " triple-click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 call MouseLeftRelease(1, 3)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 call assert_equal('S', mode(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 norm! baz
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 call assert_equal(['bazfoo'], getline(1, '$'), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 " Quadruple-click should start visual block 'select'.
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 call setline(1, ['aaaaaa', 'bbbbbb'])
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 call MouseLeftClick(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 call assert_equal(0, getcharmod(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 call MouseLeftRelease(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 call MouseLeftClick(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 call assert_equal(32, getcharmod(), msg) " double-click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 call MouseLeftRelease(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 call MouseLeftClick(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 call assert_equal(64, getcharmod(), msg) " triple-click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 call MouseLeftRelease(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 call MouseLeftClick(1, 2)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 call assert_equal(96, getcharmod(), msg) " quadruple-click
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 call MouseLeftDrag(2, 4)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 call MouseLeftRelease(2, 4)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 call assert_equal("\<c-s>", mode(), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 norm! x
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 call assert_equal(['axaa', 'bxbb'], getline(1, '$'), msg)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 endfor
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 let &mouse = save_mouse
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 let &term = save_term
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 let &ttymouse = save_ttymouse
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 set mousetime&
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 set selectmode&
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 call test_override('no_query_mouse', 0)
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 bwipe!
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 endfunc
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260
27263
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
261 " Test for selecting a register with CTRL-R
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
262 func Test_selectmode_register()
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
263 new
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
264
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
265 " Default behavior: use unnamed register
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
266 call setline(1, 'foo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
267 call setreg('"', 'bar')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
268 call setreg('a', 'baz')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
269 exe ":norm! v\<c-g>a"
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
270 call assert_equal(getline('.'), 'aoo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
271 call assert_equal('f', getreg('"'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
272 call assert_equal('baz', getreg('a'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
273
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
274 " Use the black hole register
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
275 call setline(1, 'foo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
276 call setreg('"', 'bar')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
277 call setreg('a', 'baz')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
278 exe ":norm! v\<c-g>\<c-r>_a"
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
279 call assert_equal(getline('.'), 'aoo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
280 call assert_equal('bar', getreg('"'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
281 call assert_equal('baz', getreg('a'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
282
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
283 " Invalid register: use unnamed register
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
284 call setline(1, 'foo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
285 call setreg('"', 'bar')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
286 call setreg('a', 'baz')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
287 exe ":norm! v\<c-g>\<c-r>?a"
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
288 call assert_equal(getline('.'), 'aoo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
289 call assert_equal('f', getreg('"'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
290 call assert_equal('baz', getreg('a'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
291
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
292 " Use unnamed register
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
293 call setline(1, 'foo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
294 call setreg('"', 'bar')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
295 call setreg('a', 'baz')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
296 exe ":norm! v\<c-g>\<c-r>\"a"
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
297 call assert_equal(getline('.'), 'aoo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
298 call assert_equal('f', getreg('"'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
299 call assert_equal('baz', getreg('a'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
300
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
301 " use specicifed register, unnamed register is also written
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
302 call setline(1, 'foo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
303 call setreg('"', 'bar')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
304 call setreg('a', 'baz')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
305 exe ":norm! v\<c-g>\<c-r>aa"
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
306 call assert_equal(getline('.'), 'aoo')
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
307 call assert_equal('f', getreg('"'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
308 call assert_equal('f', getreg('a'))
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
309
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
310 bw!
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
311 endfunc
93d4ee1e6113 patch 8.2.4160: cannot change the register used for Select mode delete
Bram Moolenaar <Bram@vim.org>
parents: 24138
diff changeset
312
19738
0208534b8a84 patch 8.2.0425: code for modeless selection not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 " vim: shiftwidth=2 sts=2 expandtab