Mercurial > vim
annotate src/testdir/test_winbar.vim @ 16698:23af483c4ceb v8.1.1351
patch 8.1.1351: text property wrong after :substitute
commit https://github.com/vim/vim/commit/338dfdad3844ebb1ce1d56c421d1f698c086eb0c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun May 19 15:19:57 2019 +0200
patch 8.1.1351: text property wrong after :substitute
Problem: Text property wrong after :substitute.
Solution: Save for undo before changing any text properties.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 19 May 2019 15:30:07 +0200 |
parents | d9f659007109 |
children | 6a99709c6ae3 |
rev | line source |
---|---|
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test WinBar |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 if !has('menu') |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 finish |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 endif |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
16525
1bf49cd87e6b
patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents:
16519
diff
changeset
|
7 source shared.vim |
1bf49cd87e6b
patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents:
16519
diff
changeset
|
8 |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 func Test_add_remove_menu() |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 new |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 amenu 1.10 WinBar.Next :let g:did_next = 11<CR> |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR> |
16525
1bf49cd87e6b
patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents:
16519
diff
changeset
|
13 redraw |
1bf49cd87e6b
patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents:
16519
diff
changeset
|
14 call assert_match('Next Cont', Screenline(1)) |
1bf49cd87e6b
patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents:
16519
diff
changeset
|
15 |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 emenu WinBar.Next |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call assert_equal(11, g:did_next) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 emenu WinBar.Cont |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal(12, g:did_cont) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 wincmd w |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_fails('emenu WinBar.Next', 'E334') |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 wincmd p |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 aunmenu WinBar.Next |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 aunmenu WinBar.Cont |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 close |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 endfunc |
16519
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
29 |
16537
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
30 " Create a WinBar with three buttons. |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
31 " Columns of the button edges: |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
32 " _Next_ _Cont_ _Close_ |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
33 " 2 7 10 15 18 24 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
34 func SetupWinbar() |
16519
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
35 amenu 1.10 WinBar.Next :let g:did_next = 11<CR> |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
36 amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR> |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
37 amenu 1.30 WinBar.Close :close<CR> |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
38 redraw |
16525
1bf49cd87e6b
patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents:
16519
diff
changeset
|
39 call assert_match('Next Cont Close', Screenline(1)) |
16537
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
40 endfunc |
16519
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
41 |
16537
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
42 func Test_click_in_winbar() |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
43 new |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
44 call SetupWinbar() |
16519
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
45 let save_mouse = &mouse |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
46 set mouse=a |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
47 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
48 let g:did_next = 0 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
49 let g:did_cont = 0 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
50 for col in [1, 8, 9, 16, 17, 25, 26] |
16525
1bf49cd87e6b
patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents:
16519
diff
changeset
|
51 call test_setmouse(1, col) |
16519
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
52 call feedkeys("\<LeftMouse>", "xt") |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
53 call assert_equal(0, g:did_next, 'col ' .. col) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
54 call assert_equal(0, g:did_cont, 'col ' .. col) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
55 endfor |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
56 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
57 for col in range(2, 7) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
58 let g:did_next = 0 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
59 call test_setmouse(1, col) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
60 call feedkeys("\<LeftMouse>", "xt") |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
61 call assert_equal(11, g:did_next, 'col ' .. col) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
62 endfor |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
63 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
64 for col in range(10, 15) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
65 let g:did_cont = 0 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
66 call test_setmouse(1, col) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
67 call feedkeys("\<LeftMouse>", "xt") |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
68 call assert_equal(12, g:did_cont, 'col ' .. col) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
69 endfor |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
70 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
71 let wincount = winnr('$') |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
72 call test_setmouse(1, 20) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
73 call feedkeys("\<LeftMouse>", "xt") |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
74 call assert_equal(wincount - 1, winnr('$')) |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
75 |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
76 let &mouse = save_mouse |
a147acab726f
patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents:
12487
diff
changeset
|
77 endfunc |
16537
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
78 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
79 func Test_click_in_other_winbar() |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
80 new |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
81 call SetupWinbar() |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
82 let save_mouse = &mouse |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
83 set mouse=a |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
84 let winid = win_getid() |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
85 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
86 split |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
87 let [row, col] = win_screenpos(winid) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
88 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
89 " Click on Next button in other window |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
90 let g:did_next = 0 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
91 call test_setmouse(row, 5) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
92 call feedkeys("\<LeftMouse>", "xt") |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
93 call assert_equal(11, g:did_next) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
94 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
95 " Click on Cont button in other window from Visual mode |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
96 let g:did_cont = 0 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
97 call setline(1, 'select XYZ here') |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
98 call test_setmouse(row, 12) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
99 call feedkeys("0fXvfZ\<LeftMouse>x", "xt") |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
100 call assert_equal(12, g:did_cont) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
101 call assert_equal('select here', getline(1)) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
102 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
103 " Click on Close button in other window |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
104 let wincount = winnr('$') |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
105 let winid = win_getid() |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
106 call test_setmouse(row, 20) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
107 call feedkeys("\<LeftMouse>", "xt") |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
108 call assert_equal(wincount - 1, winnr('$')) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
109 call assert_equal(winid, win_getid()) |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
110 |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
111 bwipe! |
d9f659007109
patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents:
16525
diff
changeset
|
112 endfunc |