Fix an error in areas_to_command; Tweaks.

This commit is contained in:
Xinhao Yuan 2021-02-25 23:50:35 -05:00
parent 7433ddd1ea
commit 8a304d7c5a
3 changed files with 30 additions and 28 deletions

View File

@ -462,7 +462,7 @@ function module.create(data)
local function run_cmd(cmd, screen, tag)
local gap = tag.gap
local areas = machi_engine.areas_from_command(
local areas, closed = machi_engine.areas_from_command(
cmd,
{
x = screen.workarea.x + gap,
@ -471,7 +471,7 @@ function module.create(data)
height = screen.workarea.height - gap * 2
},
gap * 2 + data.minimum_size)
if not areas then
if not areas or #closed > 0 then
return nil
end
for _, a in ipairs(areas) do

View File

@ -859,6 +859,7 @@ local function areas_to_command(areas, to_embed)
end
end
local acc_dashes = 0
if a.expansion > 1 then
for _, c in ipairs(a.split.children) do
local cr = get_command(c.id)
if cr == "-" then
@ -877,14 +878,8 @@ local function areas_to_command(areas, to_embed)
if acc_dashes > 0 then
r = r.."c"
end
elseif a.disabled then
r = "/"
elseif a.layout then
r = "x"..a.layout
else
r = "-"
end
if a.split then
if a.parent_id then
if a.expansion ~= areas[a.parent_id].expansion - 1 then
r = "t"..tostring(a.expansion)..r
@ -894,7 +889,14 @@ local function areas_to_command(areas, to_embed)
r = "t"..tostring(a.expansion)..r
end
end
elseif a.disabled then
r = "/"
elseif a.layout then
r = "x"..a.layout
else
r = "-"
end
return r
end
@ -924,9 +926,9 @@ if not in_module then
check_transcoded_command("1_10,2,1h1s131v.", "h1_10,2,1-v1,3,1.")
check_transcoded_command("332111w.", "w3,3,2,1,1,1.")
check_transcoded_command("1310111d.", ";d1,3,1,,1,1,1.")
check_transcoded_command("dw66.", "dw6,6.")
check_transcoded_command(";dw66.", ";dw6,6.")
check_transcoded_command("101dw66.", ";dw6,6.")
check_transcoded_command("dw66.", "dw6,6")
check_transcoded_command(";dw66.", ";dw6,6")
check_transcoded_command("101dw66.", ";dw6,6")
check_transcoded_command("3tdw66.", "t3;dw6,6.")
print("Passed.")
end

View File

@ -203,7 +203,7 @@ function module.create(args_or_name, editor, default_cmd)
local instance = get_instance_(tag)
local areas, draft_mode = get_areas(screen, tag)
if #areas == 0 then return end
if areas == nil then return end
local nested_clients = {}
for _, c in ipairs(cls) do