opencode does not exit on ^D #1995

Closed
opened 2026-02-16 17:33:39 -05:00 by yindo · 19 comments
Owner

Originally created by @agladysh on GitHub (Oct 8, 2025).

Originally assigned to: @nwthomas on GitHub.

Pressing CTRL+D (EOF) twice should terminate opencode. Claude and Codex support this idiomatic behavior.

Originally created by @agladysh on GitHub (Oct 8, 2025). Originally assigned to: @nwthomas on GitHub. Pressing CTRL+D (EOF) twice should terminate opencode. Claude and Codex support this idiomatic behavior.
yindo added the help-wantedgood first issue labels 2026-02-16 17:33:39 -05:00
yindo closed this issue 2026-02-16 17:33:39 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 8, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #2999: [Provide means to disable Ctrl-C] - This issue discusses the related problem of Ctrl+C behavior and mentions that applications should support proper exit behavior with common key combinations

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 8, 2025): This issue might be a duplicate of existing issues. Please check: - #2999: [Provide means to disable Ctrl-C] - This issue discusses the related problem of Ctrl+C behavior and mentions that applications should support proper exit behavior with common key combinations Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 8, 2025):

makes sense

@rekram1-node commented on GitHub (Oct 8, 2025): makes sense
Author
Owner

@jdanbrown commented on GitHub (Oct 29, 2025):

Can we also add an option that allows pressing ctrl+d once instead of twice?

  • claude requires ctrl+d twice
  • codex only requires ctrl+d once
  • Most other unix tools only require ctrl+d once
@jdanbrown commented on GitHub (Oct 29, 2025): Can we also add an option that allows pressing ctrl+d once instead of twice? - `claude` requires ctrl+d twice - `codex` only requires ctrl+d once - Most other unix tools only require ctrl+d once
Author
Owner

@rekram1-node commented on GitHub (Oct 29, 2025):

in the opentui rewrite we are making it exit on first ctrl+c so making it exit on first ctrl+d makes sense too

@rekram1-node commented on GitHub (Oct 29, 2025): in the opentui rewrite we are making it exit on first ctrl+c so making it exit on first ctrl+d makes sense too
Author
Owner

@nwthomas commented on GitHub (Oct 30, 2025):

Hey all, I'm interested in helping out. The contributing guidelines say to make a comment indicating interest.

I see this issue is assigned, but also that help-wanted label was added 3 days ago. I'd love to work on it if it's available. I currently have MacOS, Windows, and Linux (Ubuntu) setups to test the fix on.

@nwthomas commented on GitHub (Oct 30, 2025): Hey all, I'm interested in helping out. The [contributing guidelines](https://github.com/sst/opencode/blob/2a0b67d84f048207d20d952cafa10c430451dc70/CONTRIBUTING.md) say to make a comment indicating interest. I see this issue is assigned, but also that `help-wanted` label was added 3 days ago. I'd love to work on it if it's available. I currently have MacOS, Windows, and Linux (Ubuntu) setups to test the fix on.
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

Sure @nwthomas we would love that

@rekram1-node commented on GitHub (Oct 30, 2025): Sure @nwthomas we would love that
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

You can add it to the existing go codebase probably pretty easily, or if you prefer you can make a PR against the opentui branch (which is our WIP rewrite) < if u dont wanna add it here Ill just port the go code over for u

Up to you, or you can do both haha

If you need any guidance lmk here, or ping me on X or discord

@rekram1-node commented on GitHub (Oct 30, 2025): You can add it to the existing go codebase probably pretty easily, or if you prefer you can make a PR against the `opentui` branch (which is our WIP rewrite) < if u dont wanna add it here Ill just port the go code over for u Up to you, or you can do both haha If you need any guidance lmk here, or ping me on X or discord
Author
Owner

@nwthomas commented on GitHub (Oct 30, 2025):

Thank you! I'm looking to get my feet wet and contribute more, so let me start with the Go codebase and then flip to finish in opentui. Does that work?

It looks like the consensus is one ^D to quit as that's also what you're moving to with ^C (I'm assuming in the rewrite) and parallels other unix tools?

I'll join the discord as soon as I can.

@nwthomas commented on GitHub (Oct 30, 2025): Thank you! I'm looking to get my feet wet and contribute more, so let me start with the Go codebase and then flip to finish in `opentui`. Does that work? It looks like the consensus is one ^D to quit as that's also what you're moving to with ^C (I'm assuming in the rewrite) and parallels other unix tools? I'll join the discord as soon as I can.
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

@nwthomas yep, that sounds good to me

@rekram1-node commented on GitHub (Oct 30, 2025): @nwthomas yep, that sounds good to me
Author
Owner

@nwthomas commented on GitHub (Oct 31, 2025):

I have a draft PR up for the fix in this repo (see just above this comment). However, I've run into a bit of a snag and need clarification. In both opencode and opentui, the Textarea components use ctrl+d to do delete actions (see opencode and opentui).

We could decide on an alternative keybinding for the existing Textarea functionality.

However, Claude Code, for instance, only allows quitting via pressing ctrl+d twice if the text box is empty. All other times, it forward deletes text content in the Textarea as well. I'd assume that's what we want to. However, it's not my codebase so I'll defer to you all.

@nwthomas commented on GitHub (Oct 31, 2025): I have a draft PR up for the fix in this repo (see just above this comment). However, I've run into a bit of a snag and need clarification. In both `opencode` and `opentui`, the Textarea components use `ctrl+d` to do delete actions (see [opencode](https://github.com/sst/opencode/blob/51e4c9fc4cb4ef01f7d337127b463729c2967594/packages/tui/internal/components/textarea/textarea.go#L253) and [opentui](https://github.com/sst/opentui/blob/main/packages/core/src/renderables/Textarea.ts#L61)). We could decide on an alternative keybinding for the existing Textarea functionality. However, Claude Code, for instance, only allows quitting via pressing `ctrl+d` twice if the text box is empty. All other times, it forward deletes text content in the Textarea as well. I'd assume that's what we want to. However, it's not my codebase so I'll defer to you all.
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

@nwthomas I think ctrl+d only exits app if the prompt input box is empty in other tools like claude, codex, etc

@rekram1-node commented on GitHub (Oct 31, 2025): @nwthomas I think ctrl+d only exits app if the prompt input box is empty in other tools like claude, codex, etc
Author
Owner

@nwthomas commented on GitHub (Oct 31, 2025):

Yeah, exactly. Assuming that's what you all want here too, I can have that up soon.

@nwthomas commented on GitHub (Oct 31, 2025): Yeah, exactly. Assuming that's what you all want here too, I can have that up soon.
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

@nwthomas

Im sleepy and didn't read ur whole message my bad!

Yes ur proposal makes total sense, let's be consistent with other tools here

@rekram1-node commented on GitHub (Oct 31, 2025): @nwthomas Im sleepy and didn't read ur whole message my bad! Yes ur proposal makes total sense, let's be consistent with other tools here
Author
Owner

@nwthomas commented on GitHub (Oct 31, 2025):

My comment made it sound like I was proposing a different keybinding. All good.

@nwthomas commented on GitHub (Oct 31, 2025): My comment made it sound like I was proposing a different keybinding. All good.
Author
Owner

@nwthomas commented on GitHub (Oct 31, 2025):

@rekram1-node both v0 and new OpenTUI PRs are ready for review:

  1. v0
  2. OpenTUI
@nwthomas commented on GitHub (Oct 31, 2025): @rekram1-node both v0 and new OpenTUI PRs are ready for review: 1. [v0](https://github.com/sst/opencode/pull/3594) 2. [OpenTUI](https://github.com/sst/opencode/pull/3636)
Author
Owner

@alanxoc3 commented on GitHub (Oct 31, 2025):

I might not have the popular opinion here. But I'd rather "ctrl+d" be equivalent to "page down" and "ctrl+u" be equivalent to "page up".

Vim, less, and kak (my editor). And pretty sure a lot more things work that way.

It makes you not have to reach for the mouse or arrow keys as much.

@alanxoc3 commented on GitHub (Oct 31, 2025): I might not have the popular opinion here. But I'd rather "ctrl+d" be equivalent to "page down" and "ctrl+u" be equivalent to "page up". Vim, less, and kak (my editor). And pretty sure a lot more things work that way. It makes you not have to reach for the mouse or arrow keys as much.
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

@alanxoc3 we will have vim motions in the prompt input box, I think when that lands if you are in vim mode would be appropriate

@rekram1-node commented on GitHub (Oct 31, 2025): @alanxoc3 we will have vim motions in the prompt input box, I think when that lands if you are in vim mode would be appropriate
Author
Owner

@goniz commented on GitHub (Nov 22, 2025):

Shouldn’t this issue have been closed by https://github.com/sst/opencode/pull/3636 ?
@adamdotdevin @rekram1-node

@goniz commented on GitHub (Nov 22, 2025): Shouldn’t this issue have been closed by https://github.com/sst/opencode/pull/3636 ? @adamdotdevin @rekram1-node
Author
Owner

@rekram1-node commented on GitHub (Nov 22, 2025):

yup good callout

@rekram1-node commented on GitHub (Nov 22, 2025): yup good callout
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1995