ref: cfc62c33b91c49cced442b070507a701de394fd0
parent: dff78236e491c78aae00f4167f608568b7c6633d
author: penny <penny@limitedideas.org>
date: Sun Sep 28 20:21:49 EDT 2025
only find the index in the string function of the paginator once
--- a/pages.go
+++ b/pages.go
@@ -4,6 +4,7 @@
"context"
"fmt"
"strings"
+ "sync"
"codeberg.org/penny64/hellclient-go-mastodon"
"golang.org/x/term"
@@ -92,6 +93,7 @@
//don't flip the order around
disablereverse bool
itembuffer *[]PageItem
+ findindex sync.Once
}
type NotificationPages struct {hc *Hellclient
@@ -235,6 +237,8 @@
func (page *Page) String() string {var sb strings.Builder
+ page.findindex.Do(page.findIndexEnd)
+
page.findIndexEnd()
var items []PageItem
items = (*page.itembuffer)[page.index:page.indexend]
--
⑨