compose: fix mouse focus of header editors

The algorithm is broken, there may be more than one header editor with
focused=true. Reset the focused flag before forwarding the mouse event
to the composer grid.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
This commit is contained in:
Robin Jarry 2022-10-05 21:25:51 +02:00
parent e804fac59f
commit 2eef2adfbd

View file

@ -617,6 +617,12 @@ func (c *Composer) Event(event tcell.Event) bool {
func (c *Composer) MouseEvent(localX int, localY int, event tcell.Event) {
c.Lock()
defer c.Unlock()
for _, e := range c.focusable {
he, ok := e.(*headerEditor)
if ok && he.focused {
he.focused = false
}
}
c.grid.MouseEvent(localX, localY, event)
for i, e := range c.focusable {
he, ok := e.(*headerEditor)