Fix non-working mouse click on top-left and top-right cells

Scroll the tab bar only if there actually is the tab bar, otherwise
propagate the mouse click event to the bufpane.
This commit is contained in:
Dmytro Maluka
2024-06-16 13:53:09 +02:00
parent ced6d9487a
commit 602acff42f

View File

@@ -107,14 +107,15 @@ 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 {
if my == t.Y && mx == 0 {
t.Scroll(-4)
return
} else if my == t.Y && mx == t.Width-1 {
t.Scroll(4)
return
}
ind := t.LocFromVisual(buffer.Loc{mx, my})
if ind != -1 {
t.SetActive(ind)