Fix up double release event after drag
If we press mouse, drag and then release, the release event is generated twice, since both mouse press and mouse drag events have been saved in mousePressed map. To fix that, ensure that we only store mouse press events in it.
This commit is contained in:
parent
34ac83b594
commit
124fa9e2e7
1 changed files with 4 additions and 3 deletions
|
@ -443,14 +443,15 @@ func (h *BufPane) HandleEvent(event tcell.Event) {
|
|||
mod: metaToAlt(e.Modifiers()),
|
||||
state: MousePress,
|
||||
}
|
||||
if len(h.mousePressed) > 0 {
|
||||
me.state = MouseDrag
|
||||
}
|
||||
isDrag := len(h.mousePressed) > 0
|
||||
|
||||
if e.Buttons() & ^(tcell.WheelUp|tcell.WheelDown|tcell.WheelLeft|tcell.WheelRight) != tcell.ButtonNone {
|
||||
h.mousePressed[me] = true
|
||||
}
|
||||
|
||||
if isDrag {
|
||||
me.state = MouseDrag
|
||||
}
|
||||
h.DoMouseEvent(me, e)
|
||||
} else {
|
||||
// Mouse event with no click - mouse was just released.
|
||||
|
|
Loading…
Reference in a new issue