mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-26 08:50:22 +09: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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user