Revert "Further simplifies logic for active view in close-all command"
This reverts commit bb6b99b167
.
This commit is contained in:
parent
a8f4c0c4e5
commit
9592ce85f5
|
@ -596,6 +596,8 @@ end
|
||||||
|
|
||||||
|
|
||||||
function Node:close_all_docviews(keep_active)
|
function Node:close_all_docviews(keep_active)
|
||||||
|
local node_active_view = self.active_view
|
||||||
|
local lost_active_view = false
|
||||||
if self.type == "leaf" then
|
if self.type == "leaf" then
|
||||||
local i = 1
|
local i = 1
|
||||||
while i <= #self.views do
|
while i <= #self.views do
|
||||||
|
@ -603,6 +605,9 @@ function Node:close_all_docviews(keep_active)
|
||||||
if (view:is(DocView) or view:is(LogView)) and not view:is(CommandView) and
|
if (view:is(DocView) or view:is(LogView)) and not view:is(CommandView) and
|
||||||
(not keep_active or view ~= self.active_view) then
|
(not keep_active or view ~= self.active_view) then
|
||||||
table.remove(self.views, i)
|
table.remove(self.views, i)
|
||||||
|
if view == node_active_view then
|
||||||
|
lost_active_view = true
|
||||||
|
end
|
||||||
else
|
else
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
|
@ -614,10 +619,9 @@ function Node:close_all_docviews(keep_active)
|
||||||
-- top call, the primary node will take the active view anyway.
|
-- top call, the primary node will take the active view anyway.
|
||||||
-- Set the empty view and takes the active view.
|
-- Set the empty view and takes the active view.
|
||||||
self:add_view(EmptyView())
|
self:add_view(EmptyView())
|
||||||
elseif #self.views > 0 then
|
elseif #self.views > 0 and lost_active_view then
|
||||||
-- In practice we never get there but if it ever happen we need to
|
-- In practice we never get there but if a view remain we need
|
||||||
-- reset the Node's active view. We do this irrespectively of what the
|
-- to reset the Node's active view.
|
||||||
-- previous active view was.
|
|
||||||
self:set_active_view(self.views[1])
|
self:set_active_view(self.views[1])
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue