commit 09b45e5

delthas  ·  2022-09-14 13:55:17 +0000 UTC
parent 1d85e0b
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
2 files changed,  +6, -1
M app.go
M app.go
+1, -0
1@@ -795,6 +795,7 @@ func (app *App) handleIRCEvent(netID string, ev interface{}) {
2 		// Restore last buffer
3 		if netID == app.lastNetID && ev.Channel == app.lastBuffer {
4 			app.win.JumpBufferNetwork(app.lastNetID, app.lastBuffer)
5+			app.win.HorizontalBufferScrollTo()
6 			app.lastNetID = ""
7 			app.lastBuffer = ""
8 		}
+5, -1
 1@@ -253,7 +253,11 @@ func (ui *UI) HasOverlay() bool {
 2 }
 3 
 4 func (ui *UI) AddBuffer(netID, netName, title string) (i int, added bool) {
 5-	return ui.bs.Add(netID, netName, title)
 6+	i, added = ui.bs.Add(netID, netName, title)
 7+	if added {
 8+		ui.HorizontalBufferScrollTo()
 9+	}
10+	return
11 }
12 
13 func (ui *UI) RemoveBuffer(netID, title string) {