vxfw-list-set-cursor.patch

· erock's pastes · raw

expires: 2025-06-01

 1From 60a28c7f73cb61f22c40444c0f3d13a77c6da677 Mon Sep 17 00:00:00 2001
 2From: Eric Bower <me@erock.io>
 3Date: Sun, 2 Mar 2025 09:18:48 -0500
 4Subject: [PATCH] feat(vxfw/list): ability to set cursor
 5
 6This allows end-developers the ability to set the currently selected
 7list item.
 8---
 9 vxfw/list/list.go | 5 +++++
10 1 file changed, 5 insertions(+)
11
12diff --git a/vxfw/list/list.go b/vxfw/list/list.go
13index 2315c28..3c25d24 100644
14--- a/vxfw/list/list.go
15+++ b/vxfw/list/list.go
16@@ -40,6 +40,11 @@ type scroll struct {
17 	wantsCursor bool
18 }
19 
20+func (d *Dynamic) SetCursor(c uint) {
21+	d.cursor = c
22+	d.ensureScroll()
23+}
24+
25 func (d *Dynamic) CaptureEvent(ev vaxis.Event) (vxfw.Command, error) {
26 	if d.DisableEventHandlers {
27 		return nil, nil
28-- 
292.45.3
30
31