(cell: IBufferCell, oldCell: IBufferCell)
| 296 | } |
| 297 | |
| 298 | private _diffStyle(cell: IBufferCell, oldCell: IBufferCell): number[] { |
| 299 | const sgrSeq: number[] = [] |
| 300 | const fgChanged = !equalFg(cell, oldCell) |
| 301 | const bgChanged = !equalBg(cell, oldCell) |
| 302 | const flagsChanged = !equalFlags(cell, oldCell) |
| 303 | |
| 304 | if (fgChanged || bgChanged || flagsChanged) { |
| 305 | if (this._isAttributeDefault(cell)) { |
| 306 | if (!this._isAttributeDefault(oldCell)) { |
| 307 | sgrSeq.push(0) |
| 308 | } |
| 309 | } else { |
| 310 | if (flagsChanged) { |
| 311 | if (!!cell.isInverse() !== !!oldCell.isInverse()) { |
| 312 | sgrSeq.push(cell.isInverse() ? 7 : 27) |
| 313 | } |
| 314 | if (!!cell.isBold() !== !!oldCell.isBold()) { |
| 315 | sgrSeq.push(cell.isBold() ? 1 : 22) |
| 316 | } |
| 317 | if (!!cell.isUnderline() !== !!oldCell.isUnderline()) { |
| 318 | sgrSeq.push(cell.isUnderline() ? 4 : 24) |
| 319 | } |
| 320 | if (!!cell.isBlink() !== !!oldCell.isBlink()) { |
| 321 | sgrSeq.push(cell.isBlink() ? 5 : 25) |
| 322 | } |
| 323 | if (!!cell.isInvisible() !== !!oldCell.isInvisible()) { |
| 324 | sgrSeq.push(cell.isInvisible() ? 8 : 28) |
| 325 | } |
| 326 | if (!!cell.isItalic() !== !!oldCell.isItalic()) { |
| 327 | sgrSeq.push(cell.isItalic() ? 3 : 23) |
| 328 | } |
| 329 | if (!!cell.isDim() !== !!oldCell.isDim()) { |
| 330 | sgrSeq.push(cell.isDim() ? 2 : 22) |
| 331 | } |
| 332 | if (!!cell.isStrikethrough() !== !!oldCell.isStrikethrough()) { |
| 333 | sgrSeq.push(cell.isStrikethrough() ? 9 : 29) |
| 334 | } |
| 335 | } |
| 336 | if (fgChanged) { |
| 337 | const color = cell.getFgColor() |
| 338 | const mode = cell.getFgColorMode() |
| 339 | if (mode === 2 || mode === 3 || mode === -1) { |
| 340 | sgrSeq.push(38, 2, (color >>> 16) & 0xff, (color >>> 8) & 0xff, color & 0xff) |
| 341 | } else if (mode === 1) { |
| 342 | // Palette |
| 343 | if (color >= 16) { |
| 344 | sgrSeq.push(38, 5, color) |
| 345 | } else { |
| 346 | sgrSeq.push(color & 8 ? 90 + (color & 7) : 30 + (color & 7)) |
| 347 | } |
| 348 | } else { |
| 349 | sgrSeq.push(39) |
| 350 | } |
| 351 | } |
| 352 | if (bgChanged) { |
| 353 | const color = cell.getBgColor() |
| 354 | const mode = cell.getBgColorMode() |
| 355 | if (mode === 2 || mode === 3 || mode === -1) { |
no test coverage detected