(baseId: number)
| 242 | this.selectionBgCache.clear() |
| 243 | } |
| 244 | withSelectionBg(baseId: number): number { |
| 245 | const bg = this.selectionBgCode |
| 246 | if (bg === null) return this.withInverse(baseId) |
| 247 | let id = this.selectionBgCache.get(baseId) |
| 248 | if (id === undefined) { |
| 249 | // Keep everything except bg (49m) and inverse (27m). Fg, bold, dim, |
| 250 | // italic, underline, strikethrough all preserved. |
| 251 | const kept = this.get(baseId).filter( |
| 252 | c => c.endCode !== '\x1b[49m' && c.endCode !== '\x1b[27m', |
| 253 | ) |
| 254 | kept.push(bg) |
| 255 | id = this.intern(kept) |
| 256 | this.selectionBgCache.set(baseId, id) |
| 257 | } |
| 258 | return id |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | // endCodes that produce visible effects on space characters |
no test coverage detected