mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-19 15:27:20 +09:00
Don't call onSetActive for an already active pane
Currently onSetActive is called when the user clicks with the mouse on a pane even if this pane is already active. We should avoid calling it in this case. Implementation detail: like with tabs in the previous commit, we cannot check if the pane is already active just by checking the index passed to the Tab's SetActive() (since the index may not change while the pane itself changes), we need to check state of the pane itself. So we move the onSetActive invocation from the Tab's SetActive() to the BufPane's SetActive().
This commit is contained in:
@@ -679,6 +679,10 @@ func (h *BufPane) Close() {
|
||||
|
||||
// SetActive marks this pane as active.
|
||||
func (h *BufPane) SetActive(b bool) {
|
||||
if h.IsActive() == b {
|
||||
return
|
||||
}
|
||||
|
||||
h.BWindow.SetActive(b)
|
||||
if b {
|
||||
// Display any gutter messages for this line
|
||||
@@ -694,8 +698,12 @@ func (h *BufPane) SetActive(b bool) {
|
||||
if none && InfoBar.HasGutter {
|
||||
InfoBar.ClearGutter()
|
||||
}
|
||||
}
|
||||
|
||||
err := config.RunPluginFn("onSetActive", luar.New(ulua.L, h))
|
||||
if err != nil {
|
||||
screen.TermMessage(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// BufKeyActions contains the list of all possible key actions the bufhandler could execute
|
||||
|
||||
@@ -327,11 +327,6 @@ func (t *Tab) SetActive(i int) {
|
||||
p.SetActive(false)
|
||||
}
|
||||
}
|
||||
|
||||
err := config.RunPluginFn("onSetActive", luar.New(ulua.L, MainTab().CurPane()))
|
||||
if err != nil {
|
||||
screen.TermMessage(err)
|
||||
}
|
||||
}
|
||||
|
||||
// GetPane returns the pane with the given split index
|
||||
|
||||
Reference in New Issue
Block a user