From 1e8031a0e8d7d9a5d0598fce148b5800f76b1fd7 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Tue, 14 Sep 2021 04:16:46 +0200 Subject: [PATCH 1/4] Fix checking if sibling is locked when removing `View`s We only checked if sibling was locked in the `x` direction. --- data/core/rootview.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 9d017268..836f9e9a 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -142,7 +142,8 @@ function Node:remove_view(root, view) local parent = self:get_parent_node(root) local is_a = (parent.a == self) local other = parent[is_a and "b" or "a"] - if other:get_locked_size() then + local locked_size_x, locked_size_y = other:get_locked_size() + if locked_size_x or locked_size_y then self.views = {} self:add_view(EmptyView()) else From fb955e4e125da49f4f2f85bab42936c7bfaf5402 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Wed, 15 Sep 2021 03:42:59 +0200 Subject: [PATCH 2/4] Only check if sibling is locked in the split direction If the sibling is not locked in the direction of the split, it should fill the space. --- data/core/rootview.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 836f9e9a..c2895cf5 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -143,7 +143,7 @@ function Node:remove_view(root, view) local is_a = (parent.a == self) local other = parent[is_a and "b" or "a"] local locked_size_x, locked_size_y = other:get_locked_size() - if locked_size_x or locked_size_y then + if (parent.type == "hsplit" and locked_size_x or locked_size_y) then self.views = {} self:add_view(EmptyView()) else From 9bfec4aca56b5180da2fc91dbf0053e187a3c87b Mon Sep 17 00:00:00 2001 From: Guldoman Date: Wed, 15 Sep 2021 03:46:29 +0200 Subject: [PATCH 3/4] Ensure that the primary node always has a `View` --- data/core/rootview.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index c2895cf5..bd0d7423 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -143,7 +143,8 @@ function Node:remove_view(root, view) local is_a = (parent.a == self) local other = parent[is_a and "b" or "a"] local locked_size_x, locked_size_y = other:get_locked_size() - if (parent.type == "hsplit" and locked_size_x or locked_size_y) then + if self.is_primary_node + or (parent.type == "hsplit" and locked_size_x or locked_size_y) then self.views = {} self:add_view(EmptyView()) else From 66bfff2e26c20c8d8b4e3325da4ac0dabc9c0b04 Mon Sep 17 00:00:00 2001 From: Guldoman Date: Wed, 15 Sep 2021 17:30:16 +0200 Subject: [PATCH 4/4] Fix wrong locked sibling check Previously if the split type was "hsplit", but `locked_size_x` was falsy, `locked_size_y` was wrongly used. --- data/core/rootview.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index bd0d7423..0856a619 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -143,8 +143,13 @@ function Node:remove_view(root, view) local is_a = (parent.a == self) local other = parent[is_a and "b" or "a"] local locked_size_x, locked_size_y = other:get_locked_size() - if self.is_primary_node - or (parent.type == "hsplit" and locked_size_x or locked_size_y) then + local locked_size + if parent.type == "hsplit" then + locked_size = locked_size_x + else + locked_size = locked_size_y + end + if self.is_primary_node or locked_size then self.views = {} self:add_view(EmptyView()) else