diff options
| author | Francesco Abbate <francesco.bbt@gmail.com> | 2021-09-14 12:20:58 +0200 |
|---|---|---|
| committer | Francesco Abbate <francesco.bbt@gmail.com> | 2021-09-14 12:20:58 +0200 |
| commit | 5a699289243dbf2c59a171bbcebb48946d461565 (patch) | |
| tree | 202cd8c62ac56466b27067dcd97f3e83caf3da31 | |
| parent | 25744d93cefe38b20729b12dadaf2fde46ba28fd (diff) | |
| download | lite-xl-5a699289243dbf2c59a171bbcebb48946d461565.tar.gz lite-xl-5a699289243dbf2c59a171bbcebb48946d461565.zip | |
More accurate logic for node's remove view methodfix-remove-view-context
Provide an fix like:
https://github.com/lite-xl/lite-xl/pull/526
but use instead the is_primary_node property and the context
property.
We align the logic to the one used in the close_all_views method.
The approach using get_locked_size was the old approach using by
rxi's lite but it should no longer be used to determine if a node
if part of the application UI or part of the document's view.
| -rw-r--r-- | data/core/rootview.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 9d017268..067f4c2a 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -128,6 +128,18 @@ function Node:split(dir, view, locked, resizable) return self.b end + +function Node:is_application() + if self.type == "leaf" then + for i = 1, #self.views do + if self.views[i].context == "application" then return true end + end + else + return self.a:is_application() or self.b:is_application() + end +end + + function Node:remove_view(root, view) if #self.views > 1 then local idx = self:get_view_idx(view) @@ -142,7 +154,7 @@ 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 + if self.is_primary_node and other:is_application() then self.views = {} self:add_view(EmptyView()) else |
