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:
parent
4f8de02bcf
commit
06252382ec
|
@ -746,8 +746,12 @@ end
|
||||||
|
|
||||||
function core.set_active_view(view)
|
function core.set_active_view(view)
|
||||||
assert(view, "Tried to set active view to nil")
|
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 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
|
if view.doc and view.doc.filename then
|
||||||
core.set_visited(view.doc.filename)
|
core.set_visited(view.doc.filename)
|
||||||
end
|
end
|
||||||
|
|
|
@ -193,7 +193,8 @@ function NagView:next()
|
||||||
self:change_hovered(common.find_index(self.options, "default_yes"))
|
self:change_hovered(common.find_index(self.options, "default_yes"))
|
||||||
end
|
end
|
||||||
self.force_focus = self.message ~= nil
|
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
|
end
|
||||||
|
|
||||||
function NagView:show(title, message, options, on_select)
|
function NagView:show(title, message, options, on_select)
|
||||||
|
|
Loading…
Reference in New Issue