aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-10-05 21:25:51 +0200
committerRobin Jarry <robin@jarry.cc>2022-10-11 14:50:28 +0200
commit2eef2adfbdc4b1c0093021ad0f4ee3825f275906 (patch)
tree14d6044270771f70d5e6727f267aa9b29da6abf2
parente804fac59f410f395fc57c22a7853a1669efcfa4 (diff)
downloadaerc-2eef2adfbdc4b1c0093021ad0f4ee3825f275906.tar.gz
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>
-rw-r--r--widgets/compose.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index eca76842..0c26d070 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)