In `TreeView` set correct active `View` before opening new `DocView`

Before this, the new `DocView` was always added to the primary `Node`.
With this, it gets added to the last focused `Node`.
This commit is contained in:
Guldoman 2021-11-07 23:12:03 +01:00
parent 40f698e4bf
commit f99afcd29c
No known key found for this signature in database
GPG Key ID: C08A498EC7F1AFDD
1 changed files with 3 additions and 0 deletions

View File

@ -225,6 +225,9 @@ function TreeView:on_mouse_pressed(button, x, y, clicks)
end end
else else
core.try(function() core.try(function()
if core.last_active_view and core.active_view == self then
core.set_active_view(core.last_active_view)
end
local doc_filename = core.normalize_to_project_dir(hovered_item.abs_filename) local doc_filename = core.normalize_to_project_dir(hovered_item.abs_filename)
core.root_view:open_doc(core.open_doc(doc_filename)) core.root_view:open_doc(core.open_doc(doc_filename))
end) end)