* Diff one row where both screens are in bounds. * Scans for differences with findNextDiff, unpacks and calls cb for each.
( prevCells: Int32Array, nextCells: Int32Array, prev: Screen, next: Screen, ci: number, y: number, startX: number, endX: number, prevCell: Cell, nextCell: Cell, cb: DiffCallback, )
| 1228 | * Scans for differences with findNextDiff, unpacks and calls cb for each. |
| 1229 | */ |
| 1230 | function diffRowBoth( |
| 1231 | prevCells: Int32Array, |
| 1232 | nextCells: Int32Array, |
| 1233 | prev: Screen, |
| 1234 | next: Screen, |
| 1235 | ci: number, |
| 1236 | y: number, |
| 1237 | startX: number, |
| 1238 | endX: number, |
| 1239 | prevCell: Cell, |
| 1240 | nextCell: Cell, |
| 1241 | cb: DiffCallback, |
| 1242 | ): boolean { |
| 1243 | let x = startX |
| 1244 | while (x < endX) { |
| 1245 | const skip = findNextDiff(prevCells, nextCells, ci, endX - x) |
| 1246 | x += skip |
| 1247 | ci += skip << 1 |
| 1248 | if (x >= endX) break |
| 1249 | cellAtCI(prev, ci, prevCell) |
| 1250 | cellAtCI(next, ci, nextCell) |
| 1251 | if (cb(x, y, prevCell, nextCell)) return true |
| 1252 | x++ |
| 1253 | ci += 2 |
| 1254 | } |
| 1255 | return false |
| 1256 | } |
| 1257 | |
| 1258 | /** |
| 1259 | * Emit removals for a row that only exists in prev (height shrank). |
no test coverage detected