(seq: string)
| 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 |
no test coverage detected