Ensure mouse release before focus change
Fixes
@@ -166,6 +166,8 @@ type Tab struct {
active int
resizing *views.Node // node currently being resized
+ // captures whether the mouse is released
+ release bool
}
// NewTabFromBuffer creates a new tab from the given buffer
@@ -203,6 +205,8 @@ func (t *Tab) HandleEvent(event tcell.Event) {
mx, my := e.Position()
switch e.Buttons() {
case tcell.Button1:
+ wasReleased := t.release
+ t.release = false
if t.resizing != nil {
var size int
if t.resizing.Kind == views.STVert {
@@ -215,6 +219,7 @@ func (t *Tab) HandleEvent(event tcell.Event) {
return
}
+ if wasReleased {
resizeID := t.GetMouseSplitID(buffer.Loc{mx, my})
if resizeID != 0 {
t.resizing = t.GetNode(uint64(resizeID))
@@ -229,8 +234,10 @@ func (t *Tab) HandleEvent(event tcell.Event) {
break
}
}
+ }
case tcell.ButtonNone:
t.resizing = nil
+ t.release = true
default:
for _, p := range t.Panes {
v := p.GetView()
