( screen: Screen, x: number, y: number, styleId: number, )
| 815 | * for the cell so diffEach picks up the change. |
| 816 | */ |
| 817 | export function setCellStyleId( |
| 818 | screen: Screen, |
| 819 | x: number, |
| 820 | y: number, |
| 821 | styleId: number, |
| 822 | ): void { |
| 823 | if (x < 0 || y < 0 || x >= screen.width || y >= screen.height) return |
| 824 | const ci = (y * screen.width + x) << 1 |
| 825 | const cells = screen.cells |
| 826 | const word1 = cells[ci + 1]! |
| 827 | const width = word1 & WIDTH_MASK |
| 828 | // Skip spacer cells — inverse on the head cell visually covers both columns |
| 829 | if (width === CellWidth.SpacerTail || width === CellWidth.SpacerHead) return |
| 830 | const hid = (word1 >>> HYPERLINK_SHIFT) & HYPERLINK_MASK |
| 831 | cells[ci + 1] = packWord1(styleId, hid, width) |
| 832 | // Expand damage so diffEach scans this cell |
| 833 | const d = screen.damage |
| 834 | if (d) { |
| 835 | screen.damage = unionRect(d, { x, y, width: 1, height: 1 }) |
| 836 | } else { |
| 837 | screen.damage = { x, y, width: 1, height: 1 } |
| 838 | } |
| 839 | } |
| 840 | |
| 841 | /** |
| 842 | * Intern a character string via the screen's shared CharPool. |
no test coverage detected