(fixture: WrapperTmuxFixture)
| 41 | } |
| 42 | |
| 43 | async function enterMultilinePrompt(fixture: WrapperTmuxFixture): Promise<string> { |
| 44 | let pane = '' |
| 45 | for (let attempt = 0; attempt < 3; attempt += 1) { |
| 46 | if (attempt > 0) { |
| 47 | sendKeys(fixture.session, 'C-u') |
| 48 | await Bun.sleep(100) |
| 49 | } |
| 50 | |
| 51 | sendLiteral(fixture.session, 'alpha') |
| 52 | pane = |
| 53 | (await waitForPromptRows(fixture, rows => |
| 54 | rows.some(row => row.includes('alpha')), |
| 55 | )) ?? pane |
| 56 | |
| 57 | sendLiteral(fixture.session, REPL_KEY_SEQUENCES.shiftEnterKitty) |
| 58 | await Bun.sleep(150) |
| 59 | sendLiteral(fixture.session, 'beta') |
| 60 | |
| 61 | const multilinePane = await waitForPromptRows(fixture, rows => { |
| 62 | const firstRow = rows[0] ?? '' |
| 63 | return ( |
| 64 | firstRow.includes('❯') && |
| 65 | firstRow.includes('alpha') && |
| 66 | rows.slice(1).some(row => row.includes('beta')) |
| 67 | ) |
| 68 | }) |
| 69 | if (multilinePane) { |
| 70 | return multilinePane |
| 71 | } |
| 72 | |
| 73 | // Under load, tmux may deliver the literal text before the modified |
| 74 | // Enter sequence is interpreted. Send another newline+beta rather than |
| 75 | // failing on a same-line "alphabeta" prompt. |
| 76 | sendLiteral(fixture.session, REPL_KEY_SEQUENCES.shiftEnterKitty) |
| 77 | await Bun.sleep(150) |
| 78 | sendLiteral(fixture.session, 'beta') |
| 79 | const retryPane = await waitForPromptRows(fixture, rows => { |
| 80 | const firstRow = rows[0] ?? '' |
| 81 | return ( |
| 82 | firstRow.includes('❯') && |
| 83 | firstRow.includes('alpha') && |
| 84 | rows.slice(1).some(row => row.includes('beta')) |
| 85 | ) |
| 86 | }) |
| 87 | if (retryPane) { |
| 88 | return retryPane |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | return pane || capturePane(fixture.session, { startLine: 0 }) |
| 93 | } |
| 94 | |
| 95 | afterEach(() => { |
| 96 | while (liveFixtures.length > 0) { |
no test coverage detected