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

Function applySelectionOverlay

src/ink/selection.ts:893–917  ·  view source on GitHub ↗
(
  screen: Screen,
  selection: SelectionState,
  stylePool: StylePool,
)

Source from the content-addressed store, hash-verified

891 * lookup + packed-int write.
892 */
893export function applySelectionOverlay(
894 screen: Screen,
895 selection: SelectionState,
896 stylePool: StylePool,
897): void {
898 const b = selectionBounds(selection)
899 if (!b) return
900 const { start, end } = b
901 const width = screen.width
902 const noSelect = screen.noSelect
903 for (let row = start.row; row <= end.row && row < screen.height; row++) {
904 const colStart = row === start.row ? start.col : 0
905 const colEnd = row === end.row ? Math.min(end.col, width - 1) : width - 1
906 const rowOff = row * width
907 for (let col = colStart; col <= colEnd; col++) {
908 const idx = rowOff + col
909 // Skip noSelect cells — gutters stay visually unchanged so it's
910 // clear they're not part of the copy. Surrounding selectable cells
911 // still highlight so the selection extent remains visible.
912 if (noSelect[idx] === 1) continue
913 const cell = cellAtIndex(screen, idx)
914 setCellStyleId(screen, col, row, stylePool.withSelectionBg(cell.styleId))
915 }
916 }
917}
918

Callers 1

onRenderMethod · 0.85

Calls 4

selectionBoundsFunction · 0.85
cellAtIndexFunction · 0.85
setCellStyleIdFunction · 0.85
withSelectionBgMethod · 0.80

Tested by

no test coverage detected