MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / stepVisible

Function stepVisible

packages/app-core/src/components/ContextMenu.tsx:263–276  ·  view source on GitHub ↗

Move the cursor over the visible list, skipping separators and * disabled rows. Wraps at both ends.

(
  visible: Array<{ item: ContextMenuItem; originalIdx: number }>,
  from: number,
  delta: 1 | -1
)

Source from the content-addressed store, hash-verified

261/** Move the cursor over the visible list, skipping separators and
262 * disabled rows. Wraps at both ends. */
263function stepVisible(
264 visible: Array<{ item: ContextMenuItem; originalIdx: number }>,
265 from: number,
266 delta: 1 | -1
267): number {
268 if (visible.length === 0) return 0
269 let i = from
270 for (let k = 0; k < visible.length; k++) {
271 i = (i + delta + visible.length) % visible.length
272 const { item } = visible[i]
273 if (item.kind !== 'separator' && !item.disabled) return i
274 }
275 return from
276}
277
278/** Render a label with the filter substring highlighted — makes it
279 * obvious WHY a row matched the current query. */

Callers 1

handleKeyDownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected