From 2eef2adfbdc4b1c0093021ad0f4ee3825f275906 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Wed, 5 Oct 2022 21:25:51 +0200 Subject: [PATCH] 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 Tested-by: Bence Ferdinandy --- widgets/compose.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/widgets/compose.go b/widgets/compose.go index eca7684..0c26d07 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -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)