MCPcopy Create free account
hub / github.com/Noumena-Network/code / withSelectionBg

Method withSelectionBg

src/ink/screen.ts:272–287  ·  view source on GitHub ↗
(baseId: number)

Source from the content-addressed store, hash-verified

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

Callers 1

applySelectionOverlayFunction · 0.80

Calls 5

withInverseMethod · 0.95
getMethod · 0.95
internMethod · 0.95
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected