summaryrefslogtreecommitdiff
path: root/xmake/core/platform/menu.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-01-12 23:17:50 +0800
committerruki <[email protected]>2017-01-12 23:17:50 +0800
commitc7629787087e6428e42884f57762f30a5d3ae683 (patch)
tree0acaa9b5a6f9c90b7cf94fb26929060e4c545839 /xmake/core/platform/menu.lua
parenta44dac295dc3fe982616bd642f0d3e36d3d1f2ec (diff)
fix menu options newlines
Diffstat (limited to 'xmake/core/platform/menu.lua')
-rw-r--r--xmake/core/platform/menu.lua38
1 files changed, 16 insertions, 22 deletions
diff --git a/xmake/core/platform/menu.lua b/xmake/core/platform/menu.lua
index 65f882b4a..e9520b4f5 100644
--- a/xmake/core/platform/menu.lua
+++ b/xmake/core/platform/menu.lua
@@ -45,6 +45,7 @@ function menu.options(action)
-- load and merge all platform options
local exist = {}
local results = {}
+ local newline = false
for _, plat in ipairs(plats) do
-- load platform
@@ -61,38 +62,31 @@ function menu.options(action)
local options = menu[action]
if options then
- -- exists options?
- local exists = false
+ -- get the language option
for _, option in ipairs(options) do
- local name = option[2]
- if name and not exist[name] then
- exists = true
- break
- end
- end
-
- -- merge it and remove repeat if exists options
- if exists then
- -- get the platform option
- for _, option in ipairs(options) do
-
- -- merge it and remove repeat
- local name = option[2]
- if name then
- if not exist[name] then
- table.insert(results, option)
- exist[name] = true
- end
- else
+ -- merge it and remove repeat
+ local name = option[2]
+ if name then
+ if not exist[name] then
table.insert(results, option)
+ exist[name] = true
+ newline = false
end
+ elseif not newline then
+ table.insert(results, option)
+ newline = true
end
end
end
end
end
+ -- remove the last empty option
+ if results[#results][2] == nil then
+ table.remove(results)
+ end
+
-- ok?
return results
end