mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 13:05:14 +03:00
fix(app): don't interrupt the session on empty Enter (#60977)
This commit is contained in:
@@ -231,6 +231,35 @@ test("follow-up preference controls Enter while Mod+Enter uses the alternate del
|
||||
await expect(view.input).toHaveText("")
|
||||
})
|
||||
|
||||
test("a blank Enter leaves the running session alone while Stop still interrupts it, as in the TUI", async ({
|
||||
page,
|
||||
}) => {
|
||||
const mock = createQueueMock([])
|
||||
const view = await openQueue(page, mock)
|
||||
const interrupts: string[] = []
|
||||
page.on("request", (request) => {
|
||||
if (new URL(request.url()).pathname.endsWith(`/${sessionID}/interrupt`)) interrupts.push(request.url())
|
||||
})
|
||||
const stop = view.composer.getByRole("button", { name: "Stop", exact: true })
|
||||
|
||||
await expect(stop).toBeVisible()
|
||||
await view.input.click()
|
||||
await view.input.press("Enter")
|
||||
await view.input.press("ControlOrMeta+Enter")
|
||||
await view.input.pressSequentially(" ")
|
||||
await view.input.press("Enter")
|
||||
|
||||
const interrupted = page.waitForRequest((request) =>
|
||||
new URL(request.url()).pathname.endsWith(`/${sessionID}/interrupt`),
|
||||
)
|
||||
|
||||
await stop.click()
|
||||
await interrupted
|
||||
|
||||
expect(interrupts).toHaveLength(1)
|
||||
expect(mock.prompts).toEqual([])
|
||||
})
|
||||
|
||||
test("a steer shows as pending in the timeline as the composer clears, before the server admits it", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -120,11 +120,8 @@ export function createComposerSubmit(input: ComposerSubmitInput) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!read) {
|
||||
if (input.adapter.working() && input.adapter.kind === "active-session") void input.adapter.interrupt()
|
||||
|
||||
return
|
||||
}
|
||||
// Like the TUI, a blank Enter never interrupts; only Stop, Escape and Ctrl+G do.
|
||||
if (!read) return
|
||||
|
||||
// Like the TUI, a shell command runs now or not at all; it cannot wait in the queue.
|
||||
if (read.mode === "shell" && read.delivery === "queue") {
|
||||
|
||||
Reference in New Issue
Block a user