repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

commit
2d54e1f
parent
3dd7714
author
Eric Bower
date
2025-05-05 18:34:21 -0400 EDT
fix(tui): check if cursor is out-of-bounds
4 files changed,  +16, -0
M pkg/tui/analytics.go
+4, -0
 1@@ -121,6 +121,10 @@ func (m *AnalyticsPage) HandleEvent(ev vaxis.Event, phase vxfw.EventPhase) (vxfw
 2 			}), nil
 3 		}
 4 		if msg.Matches(vaxis.KeyEnter) {
 5+			cursor := int(m.leftPane.Cursor())
 6+			if cursor >= len(m.sites) {
 7+				return nil, nil
 8+			}
 9 			m.selected = m.sites[m.leftPane.Cursor()].Url
10 			m.loadingDetails = true
11 			go m.fetchSiteStats(m.selected, m.interval)
M pkg/tui/menu.go
+4, -0
 1@@ -77,6 +77,10 @@ func (m *MenuPage) HandleEvent(ev vaxis.Event, phase vxfw.EventPhase) (vxfw.Comm
 2 		}), nil
 3 	case vaxis.Key:
 4 		if msg.Matches(vaxis.KeyEnter) {
 5+			cursor := int(m.list.Cursor())
 6+			if cursor >= len(menuChoices) {
 7+				return nil, nil
 8+			}
 9 			choice := menuChoices[m.list.Cursor()]
10 			m.shared.App.PostEvent(Navigate{To: choice})
11 		}
M pkg/tui/pubkeys.go
+4, -0
 1@@ -71,6 +71,10 @@ func (m *PubkeysPage) HandleEvent(ev vaxis.Event, phase vxfw.EventPhase) (vxfw.C
 2 		}
 3 		if msg.Matches('y') {
 4 			if m.confirm {
 5+				cursor := int(m.list.Cursor())
 6+				if cursor >= len(m.keys) {
 7+					return nil, nil
 8+				}
 9 				m.confirm = false
10 				err := m.shared.Dbpool.RemoveKeys([]string{m.keys[m.list.Cursor()].ID})
11 				if err != nil {
M pkg/tui/tokens.go
+4, -0
 1@@ -65,6 +65,10 @@ func (m *TokensPage) HandleEvent(ev vaxis.Event, phase vxfw.EventPhase) (vxfw.Co
 2 		}
 3 		if msg.Matches('y') {
 4 			if m.confirm {
 5+				cursor := int(m.list.Cursor())
 6+				if cursor >= len(m.tokens) {
 7+					return nil, nil
 8+				}
 9 				m.confirm = false
10 				err := m.shared.Dbpool.RemoveToken(m.tokens[m.list.Cursor()].ID)
11 				if err != nil {