diff options
| author | Björn Linse <bjorn.linse@gmail.com> | 2019-03-16 20:41:10 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-16 20:41:10 +0100 |
| commit | 5c836d2ef8b6b2a8ad1ea7e4d7e1bf8dd9b1b93d (patch) | |
| tree | 675dd587937e8661708385e39128ed7b88f9d59f /test/functional/ui/cmdline_spec.lua | |
| parent | 11a481f711ee2d58c1157e9917779ea424ba3a45 (diff) | |
| parent | be8ebba325451b387c0aedacfcda6c53e6c51188 (diff) | |
| download | rneovim-5c836d2ef8b6b2a8ad1ea7e4d7e1bf8dd9b1b93d.tar.gz rneovim-5c836d2ef8b6b2a8ad1ea7e4d7e1bf8dd9b1b93d.tar.bz2 rneovim-5c836d2ef8b6b2a8ad1ea7e4d7e1bf8dd9b1b93d.zip | |
Merge pull request #9607 from bfredl/wildpum
UI: deprecate redundant ext_wildmenu events and allow TUI popupmenu for cmdline
Diffstat (limited to 'test/functional/ui/cmdline_spec.lua')
| -rw-r--r-- | test/functional/ui/cmdline_spec.lua | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index 5d112d7f35..16be846647 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -600,6 +600,137 @@ local function test_cmdline(linegrid) pos = 12, }}} end) + + it('works together with ext_popupmenu', function() + local expected = { + {'define', '', '', ''}, + {'jump', '', '', ''}, + {'list', '', '', ''}, + {'place', '', '', ''}, + {'undefine', '', '', ''}, + {'unplace', '', '', ''}, + } + + command('set wildmode=full') + command('set wildmenu') + screen:set_option('ext_popupmenu', true) + feed(':sign <tab>') + + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]], cmdline={{ + firstc = ":", + content = {{"sign define"}}, + pos = 11, + }}, popupmenu={items=expected, pos=0, anchor={-1, 0, 5}}} + + feed('<tab>') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]], cmdline={{ + firstc = ":", + content = {{"sign jump"}}, + pos = 9, + }}, popupmenu={items=expected, pos=1, anchor={-1, 0, 5}}} + + feed('<left><left>') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]], cmdline={{ + firstc = ":", + content = {{"sign "}}, + pos = 5, + }}, popupmenu={items=expected, pos=-1, anchor={-1, 0, 5}}} + + feed('<right>') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]], cmdline={{ + firstc = ":", + content = {{"sign define"}}, + pos = 11, + }}, popupmenu={items=expected, pos=0, anchor={-1, 0, 5}}} + + feed('a') + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]], cmdline={{ + firstc = ":", + content = {{"sign definea"}}, + pos = 12, + }}} + feed('<esc>') + + -- check positioning with multibyte char in pattern + command("e långfile1") + command("sp långfile2") + feed(':b lå<tab>') + screen:expect{grid=[[ + ^ | + {3:långfile2 }| + | + {2:långfile1 }| + | + ]], popupmenu={ + anchor = { -1, 0, 2 }, + items = {{ "långfile1", "", "", "" }, { "långfile2", "", "", "" }}, + pos = 0 + }, cmdline={{ + content = {{ "b långfile1" }}, + firstc = ":", + pos = 12 + }}} + end) + + it('ext_wildmenu takes precedence over ext_popupmenu', function() + local expected = { + 'define', + 'jump', + 'list', + 'place', + 'undefine', + 'unplace', + } + + command('set wildmode=full') + command('set wildmenu') + screen:set_option('ext_wildmenu', true) + screen:set_option('ext_popupmenu', true) + feed(':sign <tab>') + + screen:expect{grid=[[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + | + ]], cmdline={{ + firstc = ":", + content = {{"sign define"}}, + pos = 11, + }}, wildmenu_items=expected, wildmenu_pos=0} + end) + end -- the representation of cmdline and cmdline_block contents changed with ext_linegrid |