Fix dropdown[]

This commit is contained in:
luk3yx 2020-09-07 19:45:01 +12:00
parent 9a958355ca
commit 64f33a51fa
3 changed files with 21 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -117,6 +117,16 @@ def _scroll_container_hook(params):
yield params
yield params[:4]
# Fix dropdown
@hook('dropdown')
def _scroll_container_hook(params):
if isinstance(params[1][0], str):
params[1] = [('w', 'number'), ('h', 'number')]
else:
params[1] = ('w', 'number')
yield params[:5]
yield params
def _raw_parse(data):
data = data.split('\nElements\n--------\n', 1)[-1].split('\n----', 1)[0]
for line in data.split('\n'):

View File

@ -62,6 +62,7 @@ local fs = [[
container_end[]
image[0,1;1,1;air.png]
set_focus[name;true]
dropdown[0,0;1;test;abc,def,ghi,jkl;2]
]]
fs = ('\n' .. fs):gsub('\n[ \n]*', '')
@ -134,6 +135,15 @@ test_parse_unparse(fs, {
type = "set_focus",
name = "name",
force = true,
},
{
type = "dropdown",
x = 0,
y = 0,
w = 1,
name = "test",
item = {"abc", "def", "ghi", "jkl"},
selected_idx = 2,
}
})