From 09b45e5f0818d57d02329e88fce4053e4360d3f7 Mon Sep 17 00:00:00 2001 From: delthas Date: Wed, 14 Sep 2022 15:55:17 +0200 Subject: Make the last opened channel visible in the horizontal list When starting senpai, we jump to the last opened buffer. Offset the horizontal target list to make the buffer visible, as if scrolled to with CTRL+N. Fixes: https://todo.sr.ht/~taiite/senpai/100 --- app.go | 1 + ui/ui.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index 6b5614e..5ab0052 100644 --- a/app.go +++ b/app.go @@ -795,6 +795,7 @@ func (app *App) handleIRCEvent(netID string, ev interface{}) { // Restore last buffer if netID == app.lastNetID && ev.Channel == app.lastBuffer { app.win.JumpBufferNetwork(app.lastNetID, app.lastBuffer) + app.win.HorizontalBufferScrollTo() app.lastNetID = "" app.lastBuffer = "" } diff --git a/ui/ui.go b/ui/ui.go index 45c3472..155601f 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -253,7 +253,11 @@ func (ui *UI) HasOverlay() bool { } func (ui *UI) AddBuffer(netID, netName, title string) (i int, added bool) { - return ui.bs.Add(netID, netName, title) + i, added = ui.bs.Add(netID, netName, title) + if added { + ui.HorizontalBufferScrollTo() + } + return } func (ui *UI) RemoveBuffer(netID, title string) { -- cgit v1.2.3