1
0
mirror of https://github.com/zyedidia/micro synced 2024-06-29 05:54:24 +00:00

Merge pull request #3355 from dmaluka/tab-mouse-events-fix

Fix non-working mouse events at the top line of the screen
This commit is contained in:
Dmytro Maluka 2024-06-18 18:10:30 +02:00 committed by GitHub
commit 3fb34cf4f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {
@ -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
}