Closed dustdfg closed 7 months ago
I tried looking at the code and I think action.Tab.SetActive
is used when setting which pane is active but the index of the pane in the tab (not ID) is passed. The index of a pane is returned when calling Tab.GetPane
and passing the ID.
action.MainTab
is micro.CurTab
in plugins, so I think the previous pane can be set as active in the plugin like this:
local micro = import("micro")
local tab = micro.CurTab()
tab:SetActive(tab:GetPane(SideBar.back_link:ID()))
Yeah it works. Thanks! I also looked at code and saw that tab is usually used to set some pane bur overlooked GetPane
. Anyway the tab api is main facade for manipulating which pane is active but it isn't so obvious because each buffer also has function for setting active
Description of the problem or steps to reproduce
I have a plugin that opens sidebar and saves
back_link
for another pane where user was when opened the bar... At some moment I need to return user to previous pane (just makeback_link
active and sidebar not active). The following code looks like it should work but it doesn't workI see that cursor in
back_link
appears but I still control cursor in sidebar :\Attempts to do:
return error:
Plugin mdtree: runtime error: invalid memory address or nil pointer dereference stack traceback:
Specifications
Commit hash: https://github.com/zyedidia/micro/commit/68d88b571de6dca9fb8f03e2a3caafa2287c38d4 OS: Debian12 Terminal: foot