From 7f4d9789d605be378487361d731ecf02420cecf6 Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: Fri, 27 Aug 2021 13:02:28 +0200 Subject: [PATCH] Simplify commit daf91676 about active view setting --- data/core/rootview.lua | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/data/core/rootview.lua b/data/core/rootview.lua index 9cedcf52..8bc402f9 100644 --- a/data/core/rootview.lua +++ b/data/core/rootview.lua @@ -613,17 +613,15 @@ function Node:close_all_docviews(keep_active) end end self.tab_offset = 1 - if #self.views == 0 then - if self.is_primary_node then - self:add_view(EmptyView()) - elseif node_active_view == core.active_view then - -- Apparently we never gets here. In practice the primary node - -- is cleared first and get the active view on the empty view it sets. - local default_view = core.root_view:get_primary_node().views[1] - core.set_active_view(default_view) - end + if #self.views == 0 and self.is_primary_node then + -- if we are not the primary view and we had the active view it doesn't + -- matter to reattribute the active view because, within the close_all_docviews + -- top call, the primary node will take the active view anyway. + -- Set the empty view and takes the active view. + self:add_view(EmptyView()) elseif #self.views > 0 and lost_active_view then - -- We never get there either + -- In practice we never get there but if a view remain we need + -- to reset the Node's active view. self:set_active_view(self.views[1]) end else