( screen: Screen, stylePool: StylePool, positions: MatchPosition[], rowOffset: number, currentIdx: number, )
| 210 | * Positions are message-relative (row 0 = message top). rowOffset = |
| 211 | * message's current screen-top (lo). Clips outside [0, height). */ |
| 212 | export function applyPositionedHighlight( |
| 213 | screen: Screen, |
| 214 | stylePool: StylePool, |
| 215 | positions: MatchPosition[], |
| 216 | rowOffset: number, |
| 217 | currentIdx: number, |
| 218 | ): boolean { |
| 219 | if (currentIdx < 0 || currentIdx >= positions.length) return false |
| 220 | const p = positions[currentIdx]! |
| 221 | const row = p.row + rowOffset |
| 222 | if (row < 0 || row >= screen.height) return false |
| 223 | const transform = (id: number) => stylePool.withCurrentMatch(id) |
| 224 | const rowOff = row * screen.width |
| 225 | for (let col = p.col; col < p.col + p.len; col++) { |
| 226 | if (col < 0 || col >= screen.width) continue |
| 227 | const cell = cellAtIndex(screen, rowOff + col) |
| 228 | setCellStyleId(screen, col, row, transform(cell.styleId)) |
| 229 | } |
| 230 | return true |
| 231 | } |
| 232 |
no test coverage detected