MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / SetApp

Method SetApp

internal/ui/components/vm_list.go:50–75  ·  view source on GitHub ↗

SetApp sets the parent app reference for focus management.

(app *App)

Source from the content-addressed store, hash-verified

48
49// SetApp sets the parent app reference for focus management.
50func (vl *VMList) SetApp(app *App) {
51 vl.app = app
52
53 // Set up input capture for arrow keys and VI-like navigation (hjkl)
54 navigationCapture := createNavigationInputCapture(vl.app, nil, vl.app.vmDetails)
55 var pendingG bool
56 vl.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
57 if handleVimTopBottomRune(event, &pendingG, func() {
58 jumpListTop(vl.List)
59 }, func() {
60 jumpListBottom(vl.List)
61 }) {
62 return nil
63 }
64 if event.Key() == tcell.KeyRune && event.Rune() == ' ' {
65 if vm := vl.GetSelectedVM(); vm != nil && vl.app != nil {
66 vl.app.toggleGuestSelection(vm)
67 vl.SetVMs(vl.vms)
68 }
69
70 return nil
71 }
72
73 return navigationCapture(event)
74 })
75}
76
77// SetVMs updates the list with the provided VMs.
78func (vl *VMList) SetVMs(vms []*api.VM) {

Callers

nothing calls this directly

Calls 7

GetSelectedVMMethod · 0.95
SetVMsMethod · 0.95
handleVimTopBottomRuneFunction · 0.85
jumpListTopFunction · 0.85
jumpListBottomFunction · 0.85
toggleGuestSelectionMethod · 0.80

Tested by

no test coverage detected