mirror of
https://gitlab.com/luk3yx/minetest-formspec_ast.git
synced 2025-09-06 22:36:23 +02:00
Fix dropdown[]
This commit is contained in:
parent
9a958355ca
commit
64f33a51fa
File diff suppressed because one or more lines are too long
@ -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'):
|
||||
|
10
tests.lua
10
tests.lua
@ -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,
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user