Skip to content

Commit

Permalink
Merge pull request #3355 from dmaluka/tab-mouse-events-fix
Browse files Browse the repository at this point in the history
Fix non-working mouse events at the top line of the screen
  • Loading branch information
dmaluka authored Jun 18, 2024
2 parents dc62dd9 + 0a6b32d commit 3fb34cf
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions internal/action/tab.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,18 @@ func (t *TabList) HandleEvent(event tcell.Event) {
mx, my := e.Position()
switch e.Buttons() {
case tcell.Button1:
if my == t.Y && mx == 0 {
t.Scroll(-4)
return
} else if my == t.Y && mx == t.Width-1 {
t.Scroll(4)
return
}
if len(t.List) > 1 {
ind := t.LocFromVisual(buffer.Loc{mx, my})
if ind != -1 {
t.SetActive(ind)
return
}
if my == 0 {
return
if my == t.Y && len(t.List) > 1 {
if mx == 0 {
t.Scroll(-4)
} else if mx == t.Width-1 {
t.Scroll(4)
} else {
ind := t.LocFromVisual(buffer.Loc{mx, my})
if ind != -1 {
t.SetActive(ind)
}
}
return
}
case tcell.ButtonNone:
if t.List[t.Active()].release {
Expand All @@ -131,12 +127,12 @@ func (t *TabList) HandleEvent(event tcell.Event) {
return
}
case tcell.WheelUp:
if my == t.Y {
if my == t.Y && len(t.List) > 1 {
t.Scroll(4)
return
}
case tcell.WheelDown:
if my == t.Y {
if my == t.Y && len(t.List) > 1 {
t.Scroll(-4)
return
}
Expand Down

0 comments on commit 3fb34cf

Please sign in to comment.