MCPcopy
hub / github.com/anomalyco/opencode / refocus

Function refocus

packages/tui/src/ui/dialog.tsx:85–100  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83
84 let focus: Renderable | null
85 function refocus() {
86 setTimeout(() => {
87 if (!focus) return
88 if (focus.isDestroyed) return
89 function find(item: Renderable) {
90 for (const child of item.getChildren()) {
91 if (child === focus) return true
92 if (find(child)) return true
93 }
94 return false
95 }
96 const found = find(renderer.root)
97 if (!found) return
98 focus.focus()
99 }, 1)
100 }
101
102 useBindings(() => ({
103 enabled: store.stack.length > 0 && !renderer.getSelection()?.getSelectedText(),

Callers 2

initFunction · 0.85
clearFunction · 0.85

Calls 1

findFunction · 0.70

Tested by

no test coverage detected