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