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

Function resolveNextPanel

packages/app-core/src/lib/vim-nav.ts:78–90  ·  view source on GitHub ↗
(
  current: Panel | null,
  direction: 'left' | 'right',
  visiblePanels: Panel[]
)

Source from the content-addressed store, hash-verified

76
77/** Move left (h/k) or right (l/j) through the visible panel list. */
78export function resolveNextPanel(
79 current: Panel | null,
80 direction: 'left' | 'right',
81 visiblePanels: Panel[]
82): Panel | null {
83 if (visiblePanels.length === 0) return null
84 if (!current || !visiblePanels.includes(current)) return visiblePanels[0]
85 const idx = visiblePanels.indexOf(current)
86 if (direction === 'left') {
87 return idx > 0 ? visiblePanels[idx - 1] : visiblePanels[idx]
88 }
89 return idx < visiblePanels.length - 1 ? visiblePanels[idx + 1] : visiblePanels[idx]
90}
91
92// ---------------------------------------------------------------------------
93// Vim mode detection

Callers 2

handlerFunction · 0.90
vim-nav.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected