(baseId: number)
| 270 | this.selectionBgCache.clear() |
| 271 | } |
| 272 | withSelectionBg(baseId: number): number { |
| 273 | const bg = this.selectionBgCode |
| 274 | if (bg === null) return this.withInverse(baseId) |
| 275 | let id = this.selectionBgCache.get(baseId) |
| 276 | if (id === undefined) { |
| 277 | // Keep everything except bg (49m) and inverse (27m). Fg, bold, dim, |
| 278 | // italic, underline, strikethrough all preserved. |
| 279 | const kept = this.get(baseId).filter( |
| 280 | c => c.endCode !== '\x1b[49m' && c.endCode !== '\x1b[27m', |
| 281 | ) |
| 282 | kept.push(bg) |
| 283 | id = this.intern(kept) |
| 284 | this.selectionBgCache.set(baseId, id) |
| 285 | } |
| 286 | return id |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | // endCodes that produce visible effects on space characters |
no test coverage detected