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