Mercurial > vim
annotate src/testdir/test_menu.vim @ 16662:1fc9cd08cf3c v8.1.1333
patch 8.1.1333: text properties don't always move after changes
commit https://github.com/vim/vim/commit/45dd07f10af9bea86f8df77e92788209e209fdab
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed May 15 22:45:37 2019 +0200
patch 8.1.1333: text properties don't always move after changes
Problem: Text properties don't always move after changes.
Solution: Update properties before reporting changes to listeners. Move text
property when splitting a line.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 15 May 2019 23:00:15 +0200 |
parents | 822d00007b34 |
children | f38fcbf343ce |
rev | line source |
---|---|
7488
6f14d7da2d8a
commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Test that the system menu can be loaded. |
6f14d7da2d8a
commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
11044
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
3 if !has('menu') |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
4 finish |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
5 endif |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
6 |
7488
6f14d7da2d8a
commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 func Test_load_menu() |
6f14d7da2d8a
commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 try |
6f14d7da2d8a
commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 source $VIMRUNTIME/menu.vim |
6f14d7da2d8a
commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 catch |
11183
1c4ebbae41d2
patch 8.0.0478: tests use assert_true(0) and assert_false(1) to report errors
Christian Brabandt <cb@256bit.org>
parents:
11048
diff
changeset
|
11 call assert_report('error while loading menus: ' . v:exception) |
7488
6f14d7da2d8a
commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 endtry |
11048
860d023f0fc8
patch 8.0.0413: menu test fails on MS-Windows using gvim
Christian Brabandt <cb@256bit.org>
parents:
11046
diff
changeset
|
13 call assert_match('browse confirm w', execute(':menu File.Save')) |
11044
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
14 source $VIMRUNTIME/delmenu.vim |
7488
6f14d7da2d8a
commit https://github.com/vim/vim/commit/2d6c8002729821acc54a4de41d5c5f3d50594973
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endfunc |
11044
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
16 |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
17 func Test_translate_menu() |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
18 if !has('multi_lang') |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
19 return |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
20 endif |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
21 if !filereadable($VIMRUNTIME . '/lang/menu_de_de.latin1.vim') |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
22 throw 'Skipped: translated menu not found' |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
23 endif |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
24 |
11048
860d023f0fc8
patch 8.0.0413: menu test fails on MS-Windows using gvim
Christian Brabandt <cb@256bit.org>
parents:
11046
diff
changeset
|
25 " First delete any English menus. |
860d023f0fc8
patch 8.0.0413: menu test fails on MS-Windows using gvim
Christian Brabandt <cb@256bit.org>
parents:
11046
diff
changeset
|
26 source $VIMRUNTIME/delmenu.vim |
11044
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
27 set langmenu=de_de |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
28 source $VIMRUNTIME/menu.vim |
11046
d48f4eeb91ec
patch 8.0.0412: menu test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11044
diff
changeset
|
29 call assert_match('browse confirm w', execute(':menu Datei.Speichern')) |
11044
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
30 |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
31 source $VIMRUNTIME/delmenu.vim |
eb3a2ff3309a
patch 8.0.0411: menu translations don't match when case is changed.
Christian Brabandt <cb@256bit.org>
parents:
7488
diff
changeset
|
32 endfunc |
14952
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
33 |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
34 func Test_menu_commands() |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
35 nmenu 2 Test.FooBar :let g:did_menu = 'normal'<CR> |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
36 vmenu 2 Test.FooBar :let g:did_menu = 'visual'<CR> |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
37 smenu 2 Test.FooBar :let g:did_menu = 'select'<CR> |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
38 omenu 2 Test.FooBar :let g:did_menu = 'op-pending'<CR> |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
39 tlmenu 2 Test.FooBar :let g:did_menu = 'terminal'<CR> |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
40 imenu 2 Test.FooBar :let g:did_menu = 'insert'<CR> |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
41 cmenu 2 Test.FooBar :let g:did_menu = 'cmdline'<CR> |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
42 emenu n Test.FooBar |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
43 call assert_equal('normal', g:did_menu) |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
44 emenu v Test.FooBar |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
45 call assert_equal('visual', g:did_menu) |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
46 emenu s Test.FooBar |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
47 call assert_equal('select', g:did_menu) |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
48 emenu o Test.FooBar |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
49 call assert_equal('op-pending', g:did_menu) |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
50 emenu t Test.FooBar |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
51 call assert_equal('terminal', g:did_menu) |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
52 emenu i Test.FooBar |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
53 call assert_equal('insert', g:did_menu) |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
54 emenu c Test.FooBar |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
55 call assert_equal('cmdline', g:did_menu) |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
56 |
16541
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
57 nunmenu Test.FooBar |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
58 call assert_fails('emenu n Test.FooBar', 'E335: Menu not defined for Normal mode') |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
59 vunmenu Test.FooBar |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
60 call assert_fails('emenu v Test.FooBar', 'E335: Menu not defined for Visual mode') |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
61 vmenu 2 Test.FooBar :let g:did_menu = 'visual'<CR> |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
62 sunmenu Test.FooBar |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
63 call assert_fails('emenu s Test.FooBar', 'E335: Menu not defined for Select mode') |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
64 ounmenu Test.FooBar |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
65 call assert_fails('emenu o Test.FooBar', 'E335: Menu not defined for Op-pending mode') |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
66 iunmenu Test.FooBar |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
67 call assert_fails('emenu i Test.FooBar', 'E335: Menu not defined for Insert mode') |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
68 cunmenu Test.FooBar |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
69 call assert_fails('emenu c Test.FooBar', 'E335: Menu not defined for Cmdline mode') |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
70 tlunmenu Test.FooBar |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
71 call assert_fails('emenu t Test.FooBar', 'E335: Menu not defined for Terminal mode') |
822d00007b34
patch 8.1.1274: after :unmenu can still execute the menu with :emenu
Bram Moolenaar <Bram@vim.org>
parents:
14952
diff
changeset
|
72 |
14952
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
73 aunmenu Test.FooBar |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
74 call assert_fails('emenu n Test.FooBar', 'E334:') |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
75 |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
76 nmenu 2 Test.FooBar.Child :let g:did_menu = 'foobar'<CR> |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
77 call assert_fails('emenu n Test.FooBar', 'E333:') |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
78 nunmenu Test.FooBar.Child |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
79 |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
80 unlet g:did_menu |
405309f9dd13
patch 8.1.0487: no menus specifically for the terminal window
Bram Moolenaar <Bram@vim.org>
parents:
11183
diff
changeset
|
81 endfun |