From 5c2fb81b0b172604780362bea76a0df5c746c500 Mon Sep 17 00:00:00 2001 From: delthas Date: Sat, 30 Oct 2021 15:41:48 +0200 Subject: Make vertical channel list scrollable Seems like I really have too many channels... :) --- app.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'app.go') diff --git a/app.go b/app.go index 4b9d3e8..bb552e8 100644 --- a/app.go +++ b/app.go @@ -363,7 +363,7 @@ func (app *App) handleMouseEvent(ev *tcell.EventMouse) { w, _ := app.win.Size() if ev.Buttons()&tcell.WheelUp != 0 { if x < app.cfg.ChanColWidth { - // TODO scroll chan list + app.win.ScrollChannelUpBy(4) } else if x > w-app.cfg.MemberColWidth { app.win.ScrollMemberUpBy(4) } else { @@ -373,7 +373,7 @@ func (app *App) handleMouseEvent(ev *tcell.EventMouse) { } if ev.Buttons()&tcell.WheelDown != 0 { if x < app.cfg.ChanColWidth { - // TODO scroll chan list + app.win.ScrollChannelDownBy(4) } else if x > w-app.cfg.MemberColWidth { app.win.ScrollMemberDownBy(4) } else { @@ -381,11 +381,13 @@ func (app *App) handleMouseEvent(ev *tcell.EventMouse) { } } if ev.Buttons()&tcell.ButtonPrimary != 0 && x < app.cfg.ChanColWidth { - app.win.ClickBuffer(y) + app.win.ClickBuffer(y + app.win.ChannelOffset()) } if ev.Buttons() == 0 { - if y == app.win.ClickedBuffer() && x < app.cfg.ChanColWidth { - app.win.GoToBufferNo(y) + if x < app.cfg.ChanColWidth { + if i := y + app.win.ChannelOffset(); i == app.win.ClickedBuffer() { + app.win.GoToBufferNo(i) + } } app.win.ClickBuffer(-1) } -- cgit v1.2.3