Harden phone entry click state

This commit is contained in:
Joe Julian
2026-04-03 10:38:14 -07:00
parent a5397f37f8
commit 12980d5357
2 changed files with 32 additions and 2 deletions
+10 -2
View File
@@ -645,13 +645,21 @@ func (u *ui) filter() {
return
}
u.visible = visible
if len(u.entryClicks) < len(u.visible) {
u.entryClicks = make([]widget.Clickable, len(u.visible))
u.ensureEntryClicks()
}
func (u *ui) ensureEntryClicks() {
if len(u.entryClicks) >= len(u.visible) {
return
}
next := make([]widget.Clickable, len(u.visible))
copy(next, u.entryClicks)
u.entryClicks = next
}
func (u *ui) visibleEntrySnapshot() ([]entry, []*widget.Clickable) {
visible := append([]entry(nil), u.visible...)
u.ensureEntryClicks()
clicks := make([]*widget.Clickable, len(visible))
for i := range visible {
clicks[i] = &u.entryClicks[i]