diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-05-03 06:17:53 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-03 06:17:53 +0800 |
commit | 540941ef8320e2005fe65e6776fc1068f18543c6 (patch) | |
tree | 47b9ece98ebe8afa27fefebfb9245304d4cbf801 /test/functional/ui/multigrid_spec.lua | |
parent | 3ba930844c302dc43d32a30ed453667409596c4a (diff) | |
download | rneovim-540941ef8320e2005fe65e6776fc1068f18543c6.tar.gz rneovim-540941ef8320e2005fe65e6776fc1068f18543c6.tar.bz2 rneovim-540941ef8320e2005fe65e6776fc1068f18543c6.zip |
fix(pum): don't position too far with resized parent grid (#23442)
Diffstat (limited to 'test/functional/ui/multigrid_spec.lua')
-rw-r--r-- | test/functional/ui/multigrid_spec.lua | 378 |
1 files changed, 376 insertions, 2 deletions
diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua index 558b9e3e16..4c04bcb54e 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -40,6 +40,7 @@ describe('ext_multigrid', function() [21] = {background = Screen.colors.LightMagenta}, [22] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue}, [23] = {background = Screen.colors.Grey90}, + [24] = {background = Screen.colors.Grey}, }) end) @@ -1292,6 +1293,154 @@ describe('ext_multigrid', function() [4] = {{id = 1001}, "SE", 2, 16, 58, true, 50}; }} end) + + it('completion popup position', function() + insert(('\n'):rep(14) .. ('foo bar '):rep(7)) + feed('A<C-X><C-N>') + screen:expect{grid=[[ + ## grid 1 + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + | + | + | + | + | + | + | + | + | + | + | + | + | + | + foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo^ | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- Keyword Local completion (^N^P) }{15:match 1 of 2} | + ## grid 4 + {24: foo}| + {21: bar}| + ]], float_pos={ + [4] = {{id = -1}, "NW", 2, 15, 55, false, 100}; + }} + feed('<C-E><Esc>') + + command('setlocal rightleft') + feed('o<C-X><C-N>') + screen:expect{grid=[[ + ## grid 1 + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + | + | + | + | + | + | + | + | + | + | + | + | + | + | + rab oof rab oof rab oof rab oof rab oof rab oof rab oof| + ^ oof| + {1: ~}| + {1: ~}| + {1: ~}| + {1: ~}| + ## grid 3 + {7:-- Keyword Local completion (^N^P) }{15:match 1 of 2} | + ## grid 4 + {24: oof}| + {21: rab}| + ]], float_pos={ + [4] = {{id = -1}, "NW", 2, 16, 45, false, 100}; + }} + feed('<C-E><Esc>') + + command('set wildoptions+=pum') + feed(':sign un<Tab>') + screen:expect{grid=[[ + ## grid 1 + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + [2:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + | + | + | + | + | + | + | + | + | + | + | + | + | + | + rab oof rab oof rab oof rab oof rab oof rab oof rab oof| + | + {1: ~}| + {1: ~}| + {1: ~}| + {1: ~}| + ## grid 3 + :sign undefine^ | + ## grid 4 + {24: undefine }| + {21: unplace }| + ]], float_pos={ + [4] = {{id = -1}, "SW", 1, 13, 5, false, 250}; + }} + end) end) it('multiline messages scroll over windows', function() @@ -2446,8 +2595,48 @@ describe('ext_multigrid', function() ]]} meths.input_mouse('right', 'press', '', 4, 0, 64) meths.input_mouse('right', 'release', '', 4, 0, 64) - -- FIXME: popup menu position is strange - -- screen:expect{} + screen:expect{grid=[[ + ## grid 1 + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- VISUAL --} | + ## grid 4 + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do {20:eiusm}^o | + {1:~ }| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 6 + {21: Copy }| + ]], float_pos={ + [6] = {{id = -1}, "NW", 4, 1, 63, false, 250}; + }} feed('<Down><CR>') screen:expect{grid=[[ ## grid 1 @@ -2670,6 +2859,191 @@ describe('ext_multigrid', function() {1:~ }| ]]} eq('eiusmo', funcs.getreg('"')) + + screen:try_resize_grid(4, 7, 11) + screen:expect{grid=[[ + ## grid 1 + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ## grid 4 + ^Lorem i| + psum do| + lor sit| + amet, | + consect| + etur ad| + ipiscin| + g elit,| + sed do| + eiusmo| + {1:~ }| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + + funcs.setreg('"', '') + meths.input_mouse('left', 'press', '2', 4, 9, 1) + screen:expect{grid=[[ + ## grid 1 + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- VISUAL --} | + ## grid 4 + Lorem i| + psum do| + lor sit| + amet, | + consect| + etur ad| + ipiscin| + g elit,| + sed do| + {20:eiusm}^o| + {1:~ }| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + meths.input_mouse('right', 'press', '', 4, 9, 1) + meths.input_mouse('right', 'release', '', 4, 9, 1) + screen:expect{grid=[[ + ## grid 1 + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + {7:-- VISUAL --} | + ## grid 4 + Lorem i| + psum do| + lor sit| + amet, | + consect| + etur ad| + ipiscin| + g elit,| + sed do| + {20:eiusm}^o| + {1:~ }| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 6 + {21: Copy }| + ]], float_pos={ + [6] = {{id = -1}, "NW", 4, 10, 0, false, 250}; + }} + feed('<Down><CR>') + screen:expect{grid=[[ + ## grid 1 + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + [5:------------------------------]│[2:----------------------]| + {12:[No Name] [+] [No Name] [+] }| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + [4:-----------------------------------------------------]| + {11:[No Name] [+] }| + [3:-----------------------------------------------------]| + ## grid 2 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ## grid 3 + | + ## grid 4 + Lorem i| + psum do| + lor sit| + amet, | + consect| + etur ad| + ipiscin| + g elit,| + sed do| + ^eiusmo| + {1:~ }| + ## grid 5 + some text | + to be clicked | + {1:~ }| + {1:~ }| + {1:~ }| + ]]} + eq('eiusmo', funcs.getreg('"')) end) it('supports mouse drag with mouse=a', function() |