diff options
Diffstat (limited to 'test/functional/ui/wildmode_spec.lua')
-rw-r--r-- | test/functional/ui/wildmode_spec.lua | 99 |
1 files changed, 89 insertions, 10 deletions
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 50466c9473..3201135b67 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -17,6 +17,85 @@ describe("'wildmenu'", function() screen:attach() end) + -- oldtest: Test_wildmenu_screendump() + it('works', function() + screen:set_default_attr_ids({ + [0] = {bold = true, foreground = Screen.colors.Blue}; -- NonText + [1] = {foreground = Screen.colors.Black, background = Screen.colors.Yellow}; -- WildMenu + [2] = {bold = true, reverse = true}; -- StatusLine + }) + -- Test simple wildmenu + feed(':sign <Tab>') + screen:expect{grid=[[ + | + {0:~ }| + {0:~ }| + {1:define}{2: jump list > }| + :sign define^ | + ]]} + + feed('<Tab>') + screen:expect{grid=[[ + | + {0:~ }| + {0:~ }| + {2:define }{1:jump}{2: list > }| + :sign jump^ | + ]]} + + feed('<Tab>') + screen:expect{grid=[[ + | + {0:~ }| + {0:~ }| + {2:define jump }{1:list}{2: > }| + :sign list^ | + ]]} + + -- Looped back to the original value + feed('<Tab><Tab><Tab><Tab>') + screen:expect{grid=[[ + | + {0:~ }| + {0:~ }| + {2:define jump list > }| + :sign ^ | + ]]} + + -- Test that the wild menu is cleared properly + feed('<Space>') + screen:expect{grid=[[ + | + {0:~ }| + {0:~ }| + {0:~ }| + :sign ^ | + ]]} + + -- Test that a different wildchar still works + feed('<Esc>') + command('set wildchar=<Esc>') + feed(':sign <Esc>') + screen:expect{grid=[[ + | + {0:~ }| + {0:~ }| + {1:define}{2: jump list > }| + :sign define^ | + ]]} + + -- Double-<Esc> is a hard-coded method to escape while wildchar=<Esc>. Make + -- sure clean up is properly done in edge case like this. + feed('<Esc>') + screen:expect{grid=[[ + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]} + end) + it('C-E to cancel wildmenu completion restore original input', function() feed(':sign <tab>') screen:expect([[ @@ -367,12 +446,12 @@ describe("'wildmenu'", function() } -- Wildcharm? where we are going we aint't no need no wildcharm. - eq(0, meths.get_option'wildcharm') + eq(0, meths.get_option_value('wildcharm', {})) -- Don't mess the defaults yet (neovim is about backwards compatibility) - eq(9, meths.get_option'wildchar') + eq(9, meths.get_option_value('wildchar', {})) -- Lol what is cnoremap? Some say it can define mappings. command 'set wildchar=0' - eq(0, meths.get_option'wildchar') + eq(0, meths.get_option_value('wildchar', {})) command 'cnoremap <f2> <c-z>' feed(':syntax <f2>') @@ -481,9 +560,9 @@ describe('command line completion', function() end) it('does not leak memory with <S-Tab> with wildmenu and only one match #19874', function() - meths.set_option('wildmenu', true) - meths.set_option('wildmode', 'full') - meths.set_option('wildoptions', 'pum') + meths.set_option_value('wildmenu', true, {}) + meths.set_option_value('wildmode', 'full', {}) + meths.set_option_value('wildoptions', 'pum', {}) feed(':sign unpla<S-Tab>') screen:expect([[ @@ -505,8 +584,8 @@ describe('command line completion', function() end) it('does not show matches with <S-Tab> without wildmenu with wildmode=full', function() - meths.set_option('wildmenu', false) - meths.set_option('wildmode', 'full') + meths.set_option_value('wildmenu', false, {}) + meths.set_option_value('wildmode', 'full', {}) feed(':sign <S-Tab>') screen:expect([[ @@ -519,8 +598,8 @@ describe('command line completion', function() end) it('shows matches with <S-Tab> without wildmenu with wildmode=list', function() - meths.set_option('wildmenu', false) - meths.set_option('wildmode', 'list') + meths.set_option_value('wildmenu', false, {}) + meths.set_option_value('wildmode', 'list', {}) feed(':sign <S-Tab>') screen:expect([[ |