From bf2151475fd378a0143de07fe5c2111129b0d11e Mon Sep 17 00:00:00 2001 From: Xinhao Yuan Date: Tue, 2 Mar 2021 18:56:11 -0500 Subject: [PATCH] Keep instance data when adjusting. --- editor.lua | 2 +- layout.lua | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/editor.lua b/editor.lua index 0000f2e..d8ce099 100644 --- a/editor.lua +++ b/editor.lua @@ -543,7 +543,7 @@ function module.create(data) area = areas[area].parent_id end - layout.machi_set_cmd(machi_engine.areas_to_command(areas), tag) + layout.machi_set_cmd(machi_engine.areas_to_command(areas), tag, true) awful.layout.arrange(screen) end diff --git a/layout.lua b/layout.lua index 16f033f..c8c09a0 100644 --- a/layout.lua +++ b/layout.lua @@ -196,13 +196,15 @@ function module.create(args_or_name, editor, default_cmd) return instance.client_data, instance.tag_data, instance.areas_cache[key], instance, args.new_placement_cb end - local function set_cmd(cmd, tag) + local function set_cmd(cmd, tag, keep_instance_data) local instance = get_instance_(tag) if instance.cmd ~= cmd then instance.cmd = cmd instance.areas_cache = {} - instance.tag_data = {} - instance.client_data = setmetatable({}, {__mode="k"}) + if not keep_instance_data then + instance.tag_data = {} + instance.client_data = setmetatable({}, {__mode="k"}) + end end end