diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/options/cursorbind_spec.lua | 1 | ||||
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 99 | ||||
-rw-r--r-- | test/functional/ui/wildmode_spec.lua | 79 |
3 files changed, 176 insertions, 3 deletions
diff --git a/test/functional/options/cursorbind_spec.lua b/test/functional/options/cursorbind_spec.lua index 1a03ed099a..498206936a 100644 --- a/test/functional/options/cursorbind_spec.lua +++ b/test/functional/options/cursorbind_spec.lua @@ -8,6 +8,7 @@ local feed = helpers.feed before_each(clear) describe("'cursorbind'", function() + -- oldtest: Test_cursorline_cursorbind_horizontal_scroll() it("behaves consistently whether 'cursorline' is set or not vim-patch:8.2.4795", function() local screen = Screen.new(60, 8) screen:set_default_attr_ids({ diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index bfa4b7f14e..6d5546e0aa 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -3768,13 +3768,16 @@ describe('builtin popupmenu', function() ]]) end) - -- oldtest: Test_wildmenu_pum_clear_entries() - it('wildoptions=pum when using odd wildchar', function() + -- oldtest: Test_wildmenu_pum_odd_wildchar() + it('wildoptions=pum with odd wildchar', function() screen:try_resize(30, 10) + -- Test odd wildchar interactions with pum. Make sure they behave properly + -- and don't lead to memory corruption due to improperly cleaned up memory. exec([[ set wildoptions=pum set wildchar=<C-E> ]]) + feed(':sign <C-E>') screen:expect([[ | @@ -3788,7 +3791,97 @@ describe('builtin popupmenu', function() {1:~ }{n: unplace }{1: }| :sign define^ | ]]) - assert_alive() + + -- <C-E> being a wildchar takes priority over its original functionality + feed('<C-E>') + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }{n: define }{1: }| + {1:~ }{s: jump }{1: }| + {1:~ }{n: list }{1: }| + {1:~ }{n: place }{1: }| + {1:~ }{n: undefine }{1: }| + {1:~ }{n: unplace }{1: }| + :sign jump^ | + ]]) + + feed('<Esc>') + screen:expect([[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]) + + -- Escape key can be wildchar too. Double-<Esc> is hard-coded to escape + -- command-line, and we need to make sure to clean up properly. + command('set wildchar=<Esc>') + feed(':sign <Esc>') + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }{s: define }{1: }| + {1:~ }{n: jump }{1: }| + {1:~ }{n: list }{1: }| + {1:~ }{n: place }{1: }| + {1:~ }{n: undefine }{1: }| + {1:~ }{n: unplace }{1: }| + :sign define^ | + ]]) + + feed('<Esc>') + screen:expect([[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]) + + -- <C-\> can also be wildchar. <C-\><C-N> however will still escape cmdline + -- and we again need to make sure we clean up properly. + command([[set wildchar=<C-\>]]) + feed([[:sign <C-\><C-\>]]) + screen:expect([[ + | + {1:~ }| + {1:~ }| + {1:~ }{s: define }{1: }| + {1:~ }{n: jump }{1: }| + {1:~ }{n: list }{1: }| + {1:~ }{n: place }{1: }| + {1:~ }{n: undefine }{1: }| + {1:~ }{n: unplace }{1: }| + :sign define^ | + ]]) + + feed('<C-N>') + screen:expect([[ + ^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + | + ]]) end) end diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 0355c57b5a..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([[ |