From 602acff42f3d10601de1ca8d02a36f32ba7ea3a4 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sun, 16 Jun 2024 13:53:09 +0200 Subject: [PATCH 1/3] 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. --- internal/action/tab.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/action/tab.go b/internal/action/tab.go index 2a1f5a62..9c6bd01e 100644 --- a/internal/action/tab.go +++ b/internal/action/tab.go @@ -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) From badaba66f3f1dea9942b43cdbc316fee30f34cb4 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sun, 16 Jun 2024 13:56:11 +0200 Subject: [PATCH 2/3] Fix non-working mouse wheel scrolling on the top line of the screen Scroll the tab bar only if there actually is the tab bar, otherwise propagate the mouse wheel event to the bufpane. --- internal/action/tab.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/action/tab.go b/internal/action/tab.go index 9c6bd01e..b70e349f 100644 --- a/internal/action/tab.go +++ b/internal/action/tab.go @@ -132,12 +132,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 } From 0a6b32d7751f3c791e9a99acdbb1ee21f61ceb01 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Sun, 16 Jun 2024 14:02:36 +0200 Subject: [PATCH 3/3] TabList: HandleEvent: small refactoring --- internal/action/tab.go | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/internal/action/tab.go b/internal/action/tab.go index b70e349f..f5ca7fa4 100644 --- a/internal/action/tab.go +++ b/internal/action/tab.go @@ -107,23 +107,18 @@ func (t *TabList) HandleEvent(event tcell.Event) { mx, my := e.Position() switch e.Buttons() { case tcell.Button1: - if len(t.List) > 1 { - if my == t.Y && mx == 0 { + if my == t.Y && len(t.List) > 1 { + if mx == 0 { t.Scroll(-4) - return - } else if my == t.Y && mx == t.Width-1 { + } else if mx == t.Width-1 { t.Scroll(4) - return - } - - ind := t.LocFromVisual(buffer.Loc{mx, my}) - if ind != -1 { - t.SetActive(ind) - return - } - if my == 0 { - return + } else { + ind := t.LocFromVisual(buffer.Loc{mx, my}) + if ind != -1 { + t.SetActive(ind) + } } + return } case tcell.ButtonNone: if t.List[t.Active()].release {