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

Method withInverse

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

Source from the content-addressed store, hash-verified

196 */
197 private inverseCache = new Map<number, number>()
198 withInverse(baseId: number): number {
199 let id = this.inverseCache.get(baseId)
200 if (id === undefined) {
201 const baseCodes = this.get(baseId)
202 // If already inverted, use as-is (avoids SGR 7 stacking)
203 const hasInverse = baseCodes.some(c => c.endCode === '\x1b[27m')
204 id = hasInverse ? baseId : this.intern([...baseCodes, INVERSE_CODE])
205 this.inverseCache.set(baseId, id)
206 }
207 return id
208 }
209
210 /** Inverse + bold + yellow-bg-via-fg-swap for the CURRENT search match.
211 * OTHER matches are plain inverse — bg inherits from the theme. Current

Callers 2

withSelectionBgMethod · 0.95
applySearchHighlightFunction · 0.80

Calls 4

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

Tested by

no test coverage detected