MCPcopy Create free account
hub / github.com/Noumena-Network/code / cellAtIndex

Function cellAtIndex

src/ink/screen.ts:643–654  ·  view source on GitHub ↗
(screen: Screen, index: number)

Source from the content-addressed store, hash-verified

641 * index computation — caller must ensure index is valid.
642 */
643export function cellAtIndex(screen: Screen, index: number): Cell {
644 const ci = index << 1
645 const word1 = screen.cells[ci + 1]!
646 const hid = (word1 >>> HYPERLINK_SHIFT) & HYPERLINK_MASK
647 return {
648 // Unwritten cells have charIndex=0 (EMPTY_CHAR_INDEX); charPool.get(0) returns ' '
649 char: screen.charPool.get(screen.cells[ci]!),
650 styleId: word1 >>> STYLE_SHIFT,
651 width: word1 & WIDTH_MASK,
652 hyperlink: hid === 0 ? undefined : screen.hyperlinkPool.get(hid),
653 }
654}
655
656/**
657 * Get a Cell at the given index, or undefined if it has no visible content.

Callers 5

scanPositionsFunction · 0.85
applyPositionedHighlightFunction · 0.85
applySelectionOverlayFunction · 0.85
applySearchHighlightFunction · 0.85
cellAtFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected