MCPcopy Index your code
hub / github.com/codeaashu/claude-code / processSequence

Method processSequence

src/ink/termio/parser.ts:339–393  ·  view source on GitHub ↗
(seq: string)

Source from the content-addressed store, hash-verified

337 }
338
339 private processSequence(seq: string): Action[] {
340 const seqType = identifySequence(seq)
341
342 switch (seqType) {
343 case 'csi': {
344 const action = parseCSI(seq)
345 if (!action) return []
346 if (action.type === 'sgr') {
347 this.style = applySGR(action.params, this.style)
348 return []
349 }
350 return [action]
351 }
352
353 case 'osc': {
354 // Extract OSC content (between ESC ] and terminator)
355 let content = seq.slice(2)
356 // Remove terminator (BEL or ESC \)
357 if (content.endsWith('\x07')) {
358 content = content.slice(0, -1)
359 } else if (content.endsWith('\x1b\\')) {
360 content = content.slice(0, -2)
361 }
362
363 const action = parseOSC(content)
364 if (action) {
365 if (action.type === 'link') {
366 if (action.action.type === 'start') {
367 this.inLink = true
368 this.linkUrl = action.action.url
369 } else {
370 this.inLink = false
371 this.linkUrl = undefined
372 }
373 }
374 return [action]
375 }
376 return []
377 }
378
379 case 'esc': {
380 const escContent = seq.slice(1)
381 const action = parseEsc(escContent)
382 return action ? [action] : []
383 }
384
385 case 'ss3':
386 // SS3 sequences are typically cursor keys in application mode
387 // For output parsing, treat as unknown
388 return [{ type: 'unknown', sequence: seq }]
389
390 default:
391 return [{ type: 'unknown', sequence: seq }]
392 }
393 }
394}
395

Callers 1

processTokenMethod · 0.95

Calls 5

identifySequenceFunction · 0.85
parseCSIFunction · 0.85
applySGRFunction · 0.85
parseOSCFunction · 0.85
parseEscFunction · 0.85

Tested by

no test coverage detected