mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-30 16:39:33 +01:00
fix(web): scroll to the prompt on toolbar Enter, retire app.sendInput (#830)
submitFromToolbar() puts the CR on the FIFO, bypassing xterm scrollOnUserInput; scroll the focused pane before sending. Remove app.sendInput(), which has no production caller; update @dependency headers and test stubs. Retarget the codex predictive-echo recorders to _enqueueReliableInput. Correct the docs and the _sendInputAsync JSDoc for the session FIFO; drop stale _pendingInput stubs.
This commit is contained in:
1 parent
ddb5a647ba
commit
05fc2f990b
16 files changed
+86
-95
No files matched your search
@@ -236,6 +236,32 @@ describe('iOS native input served-app wiring (#830)', () => {
|
||||
});
|
||||
expect(viewport.viewportY).toBe(viewport.baseY);
|
||||
});
|
||||
|
||||
it(`toolbar Enter while scrolled back returns the viewport to the prompt (echo ${echo})`, async () => {
|
||||
await setup(echo);
|
||||
const scrolled = await page.evaluate(async () => {
|
||||
const terminal = (window as unknown as TestWindow).app.terminal;
|
||||
const written = Promise.withResolvers<void>();
|
||||
terminal.write('line\r\n'.repeat(200) + '❯ ', written.resolve);
|
||||
await written.promise;
|
||||
terminal.scrollToTop();
|
||||
return { viewportY: terminal.buffer.active.viewportY, baseY: terminal.buffer.active.baseY };
|
||||
});
|
||||
expect(scrolled.viewportY).toBe(0);
|
||||
expect(scrolled.baseY).toBeGreaterThan(0);
|
||||
await page
|
||||
.locator('button[onclick="app.sendEnterKey()"]')
|
||||
.evaluate((button: HTMLButtonElement) => button.click());
|
||||
// Echo on delivers the CR after the local-echo gap: wait for it on the wire.
|
||||
await page.waitForFunction(() => (window as unknown as TestWindow).__sent.some((x) => x.input === '\r'));
|
||||
const sent = await page.evaluate(() => (window as unknown as TestWindow).__sent.map((x) => x.input));
|
||||
expect(sent).toEqual(['\r']);
|
||||
const viewport = await page.evaluate(() => {
|
||||
const buffer = (window as unknown as TestWindow).app.terminal.buffer.active;
|
||||
return { viewportY: buffer.viewportY, baseY: buffer.baseY };
|
||||
});
|
||||
expect(viewport.viewportY).toBe(viewport.baseY);
|
||||
});
|
||||
}
|
||||
|
||||
for (const target of ['main', 'tile'] as const) {
|
||||
|
||||
Reference in new issue
Block a user