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

Method processText

src/ink/termio/parser.ts:355–383  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

353 }
354
355 private processText(text: string): Action[] {
356 // Handle BEL characters embedded in text
357 const actions: Action[] = []
358 let current = ''
359
360 for (const char of text) {
361 if (char.charCodeAt(0) === C0.BEL) {
362 if (current) {
363 const graphemes = [...segmentGraphemes(current)]
364 if (graphemes.length > 0) {
365 actions.push({ type: 'text', graphemes, style: { ...this.style } })
366 }
367 current = ''
368 }
369 actions.push({ type: 'bell' })
370 } else {
371 current += char
372 }
373 }
374
375 if (current) {
376 const graphemes = [...segmentGraphemes(current)]
377 if (graphemes.length > 0) {
378 actions.push({ type: 'text', graphemes, style: { ...this.style } })
379 }
380 }
381
382 return actions
383 }
384
385 private processSequence(seq: string): Action[] {
386 const seqType = identifySequence(seq)

Callers 1

processTokenMethod · 0.95

Calls 1

segmentGraphemesFunction · 0.85

Tested by

no test coverage detected