( screen: Screen, selection: SelectionState, stylePool: StylePool, )
| 891 | * lookup + packed-int write. |
| 892 | */ |
| 893 | export 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 |
no test coverage detected