diff options
Diffstat (limited to 'test/functional/ui/popupmenu_spec.lua')
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 217 |
1 files changed, 216 insertions, 1 deletions
diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 6a10f60ad8..582f357972 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -999,9 +999,52 @@ describe('builtin popupmenu', function() {1:~ }| {2:-- INSERT --} | ]]) + + screen:try_resize(25,10) + screen:expect([[ + some long prefix before | + the text^ | + {1:~ }{n: word }{1: }| + {1:~ }{n: choice }{1: }| + {1:~ }{s: text }{1: }| + {1:~ }{n: thing }{1: }| + {1:~ }| + {1:~ }| + {1:~ }| + {2:-- INSERT --} | + ]]) + + screen:try_resize(12,5) + screen:expect([[ + some long | + prefix | + bef{n: word } | + tex{n: }^ | + {2:-- }{s: text } | + ]]) + + -- can't draw the pum, but check we don't crash + screen:try_resize(12,2) + screen:expect([[ + text^ | + {2:-- INSERT -} | + ]]) + + -- but state is preserved, pum reappears + screen:try_resize(20,8) + screen:expect([[ + some long prefix | + before the text^ | + {1:~ }{n: word }| + {1:~ }{n: choice }| + {1:~ }{s: text }| + {1:~ }{n: thing }| + {1:~ }| + {2:-- INSERT --} | + ]]) end) - it('can be moved due to wrap or resize', function() + it('works with rightleft window', function() command("set rl") feed('isome rightleft ') screen:expect([[ @@ -1230,4 +1273,176 @@ describe('builtin popupmenu', function() ]]) end) + it('works with pumblend', function() + screen:try_resize(60,14) + screen:set_default_attr_ids({ + [1] = {background = Screen.colors.Yellow}, + [2] = {bold = true, reverse = true}, + [3] = {bold = true, foreground = Screen.colors.Brown}, + [4] = {foreground = Screen.colors.Blue1}, + [5] = {reverse = true}, + [6] = {background = Screen.colors.Gray55, foreground = Screen.colors.Grey45, special = Screen.colors.Red}, + [7] = {background = Screen.colors.Gray55, foreground = Screen.colors.Grey0, special = Screen.colors.Red}, + [8] = {background = tonumber('0x191919'), foreground = Screen.colors.Grey0, special = Screen.colors.Red}, + [9] = {background = tonumber('0xffc1ff'), foreground = tonumber('0xe5a8e5'), special = Screen.colors.Red}, + [10] = {background = tonumber('0xffc1ff'), foreground = Screen.colors.Grey0, special = Screen.colors.Red}, + [11] = {foreground = tonumber('0xe5a8e5'), special = Screen.colors.Red, background = tonumber('0xffc1ff'), reverse = true, bold = true}, + [12] = {foreground = Screen.colors.Grey45, special = Screen.colors.Red, background = Screen.colors.Gray55, reverse = true, bold = true}, + [13] = {background = tonumber('0xffc1e5'), foreground = Screen.colors.Grey0, special = Screen.colors.Red}, + [14] = {background = tonumber('0xffc1e5'), foreground = tonumber('0xe5a8e5'), special = Screen.colors.Red}, + [15] = {background = tonumber('0xffc1ff'), foreground = tonumber('0x080202'), special = Screen.colors.Red}, + [16] = {special = Screen.colors.Red, background = tonumber('0xffc1ff'), bold = true, foreground = tonumber('0xf6ace9')}, + [17] = {background = tonumber('0xffc1ff'), foreground = tonumber('0xe5a8ff'), special = Screen.colors.Red}, + [18] = {special = Screen.colors.Red, background = tonumber('0xffc1ff'), reverse = true, foreground = tonumber('0xe5a8e5')}, + [19] = {special = Screen.colors.Red, background = Screen.colors.Gray55, reverse = true, foreground = Screen.colors.Grey45}, + [20] = {bold = true}, + [21] = {bold = true, foreground = Screen.colors.SeaGreen4}, + [22] = {background = Screen.colors.WebGray}, + [23] = {background = Screen.colors.Grey0}, + [24] = {background = Screen.colors.LightMagenta}, + [25] = {background = Screen.colors.Gray75, foreground = Screen.colors.Grey25, special = Screen.colors.Red}, + [26] = {background = Screen.colors.Gray75, foreground = Screen.colors.Grey0, special = Screen.colors.Red}, + [27] = {background = Screen.colors.Gray50, foreground = Screen.colors.Grey0, special = Screen.colors.Red}, + [28] = {background = tonumber('0xffddff'), foreground = tonumber('0x7f5d7f'), special = Screen.colors.Red}, + [29] = {background = tonumber('0xffddff'), foreground = Screen.colors.Grey0, special = Screen.colors.Red}, + [30] = {foreground = tonumber('0x7f5d7f'), special = Screen.colors.Red, background = tonumber('0xffddff'), reverse = true, bold = true}, + [31] = {foreground = Screen.colors.Grey0, special = Screen.colors.Red, background = tonumber('0xffddff'), reverse = true, bold = true}, + [32] = {foreground = Screen.colors.Grey25, special = Screen.colors.Red, background = Screen.colors.Gray75, reverse = true, bold = true}, + [33] = {background = tonumber('0xffdd7f'), foreground = Screen.colors.Grey0, special = Screen.colors.Red}, + [34] = {background = tonumber('0xffdd7f'), foreground = tonumber('0x7f5d7f'), special = Screen.colors.Red}, + [35] = {special = Screen.colors.Red, background = tonumber('0xffddff'), bold = true, foreground = tonumber('0x290a0a')}, + [36] = {special = Screen.colors.Red, background = tonumber('0xffddff'), bold = true, foreground = tonumber('0xd27294')}, + [37] = {background = tonumber('0xffddff'), foreground = tonumber('0x7f5dff'), special = Screen.colors.Red}, + [38] = {special = Screen.colors.Red, background = tonumber('0xffddff'), reverse = true, foreground = tonumber('0x7f5d7f')}, + [39] = {special = Screen.colors.Red, background = tonumber('0xffddff'), reverse = true, foreground = Screen.colors.Grey0}, + [40] = {special = Screen.colors.Red, background = Screen.colors.Gray75, reverse = true, foreground = Screen.colors.Grey25}, + [41] = {background = tonumber('0xffddff'), foreground = tonumber('0x00003f'), special = Screen.colors.Red}, + }) + command('syntax on') + command('set mouse=a') + command('set pumblend=10') + insert([[ + Lorem ipsum dolor sit amet, consectetur + adipisicing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. + Ut enim ad minim veniam, quis nostrud + exercitation ullamco laboris nisi ut aliquip ex + ea commodo consequat. Duis aute irure dolor in + reprehenderit in voluptate velit esse cillum + dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa + qui officia deserunt mollit anim id est + laborum.]]) + command('match Statement /el/') + command('2match Comment /ut/') + command('1') + command('split') + command('/ol') + screen:expect([[ + Lorem ipsum d{1:ol}or sit amet, consectetur | + adipisicing elit, sed do eiusmod tempor | + ^incididunt ut labore et d{1:ol}ore magna aliqua. | + Ut enim ad minim veniam, quis nostrud | + exercitation ullamco laboris nisi ut aliquip ex | + ea commodo consequat. Duis aute irure d{1:ol}or in | + {2:[No Name] [+] }| + Lorem ipsum d{1:ol}or sit amet, consectetur | + adipisicing {3:el}it, sed do eiusmod tempor | + incididunt {4:ut} labore et d{1:ol}ore magna aliqua. | + Ut enim ad minim veniam, quis nostrud | + exercitation ullamco laboris nisi {4:ut} aliquip ex | + {5:[No Name] [+] }| + | + ]]) + + feed('Obla bla <c-x><c-n>') + screen:expect([[ + Lorem ipsum d{1:ol}or sit amet, consectetur | + adipisicing elit, sed do eiusmod tempor | + bla bla incididunt^ | + incidid{6:u}{7:incididunt}{6:re et}{8: }d{1:ol}ore magna aliqua. | + Ut enim{9: }{10:ut}{9: minim veniam}{6:,} quis nostrud | + exercit{9:a}{10:labore}{9:llamco la}{6:b}oris nisi ut aliquip ex | + {2:[No Nam}{11:e}{10:et}{11:[+] }{12: }{2: }| + Lorem i{9:p}{10:dolor}{13:e}{14:l}{9:or sit a}{6:m}et, consectetur | + adipisi{9:c}{10:magn}{15:a}{16:l}{9:it, sed d}{6:o} eiusmod tempor | + bla bla{9: }{10:aliqua}{9:dunt }{6: } | + incidid{9:u}{10:Ut}{9: }{17:ut}{9: labore et}{6: }d{1:ol}ore magna aliqua. | + Ut enim{9: }{10:enim}{9:inim veniam}{6:,} quis nostrud | + {5:[No Nam}{18:e}{10:ad}{18:[+] }{19: }{5: }| + {20:-- Keyword Local completion (^N^P) }{21:match 1 of 65} | + ]]) + + command('set pumblend=0') + screen:expect([[ + Lorem ipsum d{1:ol}or sit amet, consectetur | + adipisicing elit, sed do eiusmod tempor | + bla bla incididunt^ | + incidid{22: incididunt }{23: }d{1:ol}ore magna aliqua. | + Ut enim{24: ut }{22: } quis nostrud | + exercit{24: labore }{22: }oris nisi ut aliquip ex | + {2:[No Nam}{24: et }{22: }{2: }| + Lorem i{24: dolore }{22: }et, consectetur | + adipisi{24: magna }{22: } eiusmod tempor | + bla bla{24: aliqua }{22: } | + incidid{24: Ut }{22: }d{1:ol}ore magna aliqua. | + Ut enim{24: enim }{22: } quis nostrud | + {5:[No Nam}{24: ad }{22: }{5: }| + {20:-- Keyword Local completion (^N^P) }{21:match 1 of 65} | + ]]) + + command('set pumblend=50') + screen:expect([[ + Lorem ipsum d{1:ol}or sit amet, consectetur | + adipisicing elit, sed do eiusmod tempor | + bla bla incididunt^ | + incidid{25:u}{26:incididunt}{25:re et}{27: }d{1:ol}ore magna aliqua. | + Ut enim{28: }{29:ut}{28: minim veniam}{25:,} quis nostrud | + exercit{28:a}{29:labore}{28:llamco la}{25:b}oris nisi ut aliquip ex | + {2:[No Nam}{30:e}{31:et}{30:[+] }{32: }{2: }| + Lorem i{28:p}{29:dolor}{33:e}{34:l}{28:or sit a}{25:m}et, consectetur | + adipisi{28:c}{29:magn}{35:a}{36:l}{28:it, sed d}{25:o} eiusmod tempor | + bla bla{28: }{29:aliqua}{28:dunt }{25: } | + incidid{28:u}{29:Ut}{28: }{37:ut}{28: labore et}{25: }d{1:ol}ore magna aliqua. | + Ut enim{28: }{29:enim}{28:inim veniam}{25:,} quis nostrud | + {5:[No Nam}{38:e}{39:ad}{38:[+] }{40: }{5: }| + {20:-- Keyword Local completion (^N^P) }{21:match 1 of 65} | + ]]) + + meths.input_mouse('wheel', 'down', '', 0, 9, 40) + screen:expect([[ + Lorem ipsum d{1:ol}or sit amet, consectetur | + adipisicing elit, sed do eiusmod tempor | + bla bla incididunt^ | + incidid{25:u}{26:incididunt}{25:re et}{27: }d{1:ol}ore magna aliqua. | + Ut enim{28: }{29:ut}{28: minim veniam}{25:,} quis nostrud | + exercit{28:a}{29:labore}{28:llamco la}{25:b}oris nisi ut aliquip ex | + {2:[No Nam}{30:e}{31:et}{30:[+] }{32: }{2: }| + incidid{28:u}{29:dol}{41:or}{29:e}{28:labore et}{25: }d{1:ol}ore magna aliqua. | + Ut enim{28: }{29:magna}{28:nim veniam}{25:,} quis nostrud | + exercit{28:a}{29:aliqua}{28:llamco la}{25:b}oris nisi {4:ut} aliquip ex | + ea comm{28:o}{29:Ut}{28: consequat. D}{25:u}is a{4:ut}e irure d{1:ol}or in | + reprehe{28:n}{29:enim}{28:t in v}{34:ol}{28:upt}{25:a}te v{3:el}it esse cillum | + {5:[No Nam}{38:e}{39:ad}{38:[+] }{40: }{5: }| + {20:-- Keyword Local completion (^N^P) }{21:match 1 of 65} | + ]]) + + feed('<c-e>') + screen:expect([[ + Lorem ipsum d{1:ol}or sit amet, consectetur | + adipisicing elit, sed do eiusmod tempor | + bla bla ^ | + incididunt ut labore et d{1:ol}ore magna aliqua. | + Ut enim ad minim veniam, quis nostrud | + exercitation ullamco laboris nisi ut aliquip ex | + {2:[No Name] [+] }| + incididunt {4:ut} labore et d{1:ol}ore magna aliqua. | + Ut enim ad minim veniam, quis nostrud | + exercitation ullamco laboris nisi {4:ut} aliquip ex | + ea commodo consequat. Duis a{4:ut}e irure d{1:ol}or in | + reprehenderit in v{1:ol}uptate v{3:el}it esse cillum | + {5:[No Name] [+] }| + {20:-- INSERT --} | + ]]) + end) end) |