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:
parent
e804fac59f
commit
2eef2adfbd
1 changed files with 6 additions and 0 deletions
|
@ -617,6 +617,12 @@ func (c *Composer) Event(event tcell.Event) bool {
|
||||||
func (c *Composer) MouseEvent(localX int, localY int, event tcell.Event) {
|
func (c *Composer) MouseEvent(localX int, localY int, event tcell.Event) {
|
||||||
c.Lock()
|
c.Lock()
|
||||||
defer c.Unlock()
|
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)
|
c.grid.MouseEvent(localX, localY, event)
|
||||||
for i, e := range c.focusable {
|
for i, e := range c.focusable {
|
||||||
he, ok := e.(*headerEditor)
|
he, ok := e.(*headerEditor)
|
||||||
|
|
Loading…
Reference in a new issue