internal refactoring

This commit is contained in:
Xinhao Yuan 2019-07-12 16:21:35 -04:00
parent c1ab5bc81b
commit 2436da4c89
2 changed files with 6 additions and 2 deletions

View File

@ -651,7 +651,7 @@ local function create(data)
end
-- bring the current cmd to the front
data.cmds[#data.cmds + 1] = current_cmd
data.last_cmd[layout.machi_instance_name] = current_cmd
data.last_cmd[layout.machi_get_instance_name(screen)] = current_cmd
if data.history_file then
local file, err = io.open(data.history_file, "w")

View File

@ -52,6 +52,10 @@ local function create(name, editor)
regions_cache = {}
}
local function get_instance_name(_screen)
return name
end
local function get_regions(workarea, _screen)
if priv.cmd == nil then return {} end
local key = tostring(workarea.width) .. "x" .. tostring(workarea.height) .. "+" .. tostring(workarea.x) .. "+" .. tostring(workarea.y)
@ -140,7 +144,7 @@ local function create(name, editor)
name = "machi",
arrange = arrange,
resize_handler = resize_handler,
machi_instance_name = name,
machi_get_instance_name = get_instance_name,
machi_set_cmd = set_cmd,
machi_get_regions = get_regions,
}