Fix focus problem with NagView with root:close-all

Fix provided by @Guldoman in PR:

https://github.com/lite-xl/lite-xl/pull/419
This commit is contained in:
Francesco Abbate 2021-08-28 00:21:29 +02:00
parent 4f8de02bcf
commit 06252382ec
2 changed files with 7 additions and 2 deletions

View File

@ -746,8 +746,12 @@ end
function core.set_active_view(view)
assert(view, "Tried to set active view to nil")
if core.active_view and core.active_view.force_focus then return end
if view ~= core.active_view then
if core.active_view and core.active_view.force_focus then
core.next_active_view = view
return
end
core.next_active_view = nil
if view.doc and view.doc.filename then
core.set_visited(view.doc.filename)
end

View File

@ -193,7 +193,8 @@ function NagView:next()
self:change_hovered(common.find_index(self.options, "default_yes"))
end
self.force_focus = self.message ~= nil
core.set_active_view(self.message ~= nil and self or core.last_active_view)
core.set_active_view(self.message ~= nil and self or
core.next_active_view or core.last_active_view)
end
function NagView:show(title, message, options, on_select)