MCPcopy Index your code
hub / github.com/codeaashu/claude-code / visibleCellAtIndex

Function visibleCellAtIndex

src/ink/screen.ts:624–650  ·  view source on GitHub ↗
(
  cells: Int32Array,
  charPool: CharPool,
  hyperlinkPool: HyperlinkPool,
  index: number,
  lastRenderedStyleId: number,
)

Source from the content-addressed store, hash-verified

622 * line, or -1 if none yet.
623 */
624export function visibleCellAtIndex(
625 cells: Int32Array,
626 charPool: CharPool,
627 hyperlinkPool: HyperlinkPool,
628 index: number,
629 lastRenderedStyleId: number,
630): Cell | undefined {
631 const ci = index << 1
632 const charId = cells[ci]!
633 if (charId === 1) return undefined // spacer
634 const word1 = cells[ci + 1]!
635 // For spaces: 0x3fffc masks bits 2-17 (hyperlinkId + styleId visibility
636 // bit). If zero, the space has no hyperlink and at most a fg-only style.
637 // Then word1 >>> STYLE_SHIFT is the foreground style — skip if it's zero
638 // (truly invisible) or matches the last rendered style on this line.
639 if (charId === 0 && (word1 & 0x3fffc) === 0) {
640 const fgStyle = word1 >>> STYLE_SHIFT
641 if (fgStyle === 0 || fgStyle === lastRenderedStyleId) return undefined
642 }
643 const hid = (word1 >>> HYPERLINK_SHIFT) & HYPERLINK_MASK
644 return {
645 char: charPool.get(charId),
646 styleId: word1 >>> STYLE_SHIFT,
647 width: word1 & WIDTH_MASK,
648 hyperlink: hid === 0 ? undefined : hyperlinkPool.get(hid),
649 }
650}
651
652/**
653 * Write cell data into an existing Cell object to avoid allocation.

Callers 1

renderFrameSliceFunction · 0.85

Calls 1

getMethod · 0.65

Tested by

no test coverage detected