[FEATURE]: Can use ctrl+c twice to close the tui? #7828

Open
opened 2026-02-16 18:08:23 -05:00 by yindo · 15 comments
Owner

Originally created by @haimu0427 on GitHub (Jan 28, 2026).

Originally assigned to: @kommander on GitHub.

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Although it is possible to use the mouse to control copy and paste, as a windows user, I often use ctrl + c to do so, and often fail to close the windows tui opencode.
If this is a good idea, I can add this feature.

Originally created by @haimu0427 on GitHub (Jan 28, 2026). Originally assigned to: @kommander on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request Although it is possible to use the mouse to control copy and paste, as a windows user, I often use ctrl + c to do so, and often fail to close the windows tui opencode. If this is a good idea, I can add this feature.
yindo added the opentuidiscussion labels 2026-02-16 18:08:23 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 28, 2026):

For keybind-related issues, please also check our pinned keybinds documentation: #4997

This issue might be a duplicate of or related to:

  • #2999: Provide means to disable Ctrl-C (Windows quits app instead of copy) - Discusses the challenge of using Ctrl+C on Windows where it currently quits the application instead of copying
  • #10867: [Bug][WSL][tmux]: Cannot be interrupted by ESC - Related to interrupt/control key handling in TUI

Feel free to check those issues first to see if they address your use case or provide context for this feature request.

@github-actions[bot] commented on GitHub (Jan 28, 2026): For keybind-related issues, please also check our pinned keybinds documentation: #4997 This issue might be a duplicate of or related to: - #2999: Provide means to disable Ctrl-C (Windows quits app instead of copy) - Discusses the challenge of using Ctrl+C on Windows where it currently quits the application instead of copying - #10867: [Bug][WSL][tmux]: Cannot be interrupted by ESC - Related to interrupt/control key handling in TUI Feel free to check those issues first to see if they address your use case or provide context for this feature request.
Author
Owner

@bezerraluiz commented on GitHub (Jan 28, 2026):

Hi! I was testing it here and saw that it's possible to copy the AI output simply by selecting what it returned in the terminal, without needing to use the CTRL+C shortcut.

I can show it better in the screenshorts.


Image Image
@bezerraluiz commented on GitHub (Jan 28, 2026): Hi! I was testing it here and saw that it's possible to copy the AI output simply by selecting what it returned in the terminal, without needing to use the CTRL+C shortcut. I can show it better in the screenshorts. --- <img width="1427" height="482" alt="Image" src="https://github.com/user-attachments/assets/278b1ca3-10e6-4c1f-bb19-7f8886645933" /> <img width="1427" height="482" alt="Image" src="https://github.com/user-attachments/assets/d8194c30-da60-47e7-8232-1503d915dd90" />
Author
Owner

@haimu0427 commented on GitHub (Jan 28, 2026):

Hi! I was testing it here and saw that it's possible to copy the AI output simply by selecting what it returned in the terminal, without needing to use the CTRL+C shortcut.

I can show it better in the screenshorts.


Image Image

You are right. But it's easy for me to exit opencode. Because I often use ctrl c.
Claude code was designed to prevent me from pressing Ctrl C by mistake. Because it needs to be pressed twice to exit.

@haimu0427 commented on GitHub (Jan 28, 2026): > Hi! I was testing it here and saw that it's possible to copy the AI output simply by selecting what it returned in the terminal, without needing to use the CTRL+C shortcut. > > I can show it better in the screenshorts. > > --- > > <img width="1427" height="482" alt="Image" src="https://github.com/user-attachments/assets/278b1ca3-10e6-4c1f-bb19-7f8886645933" /> > > <img width="1427" height="482" alt="Image" src="https://github.com/user-attachments/assets/d8194c30-da60-47e7-8232-1503d915dd90" /> You are right. But it's easy for me to exit opencode. Because I often use ctrl c. Claude code was designed to prevent me from pressing Ctrl C by mistake. Because it needs to be pressed twice to exit.
Author
Owner

@bezerraluiz commented on GitHub (Jan 28, 2026):

I'll take a look at what I can do here and I'll comment on my results here later.

@bezerraluiz commented on GitHub (Jan 28, 2026): I'll take a look at what I can do here and I'll comment on my results here later.
Author
Owner

@bezerraluiz commented on GitHub (Jan 28, 2026):

Hello again, I updated the config.ts file and now the shortcut to clear the input is CTRL+L and the shortcut to copy to the console is CTRL+D. What do you think? I haven't submitted a pull request because I want to hear your opinion first.

Now, when selecting output, you can use the shortcut CTRL+C and the action to automatically copy to the clipboard is still enabled.


Documentation:

Shortcuts: Copy vs Exit

Problem

In OpenCode TUI, Ctrl+C is often used as a global shortcut for exit (app_exit). For those accustomed to Ctrl+C = copy, this can unintentionally close the CLI.

Recommended Solution

  1. Remove Ctrl+C from the exit shortcut (keybinds.app_exit)
  2. Use another shortcut for “clear input” (e.g., Ctrl+L)
  3. Keep exit via Ctrl+D

Toggle quickly in TUI

In the prompt, run:

  • /togglecopy (toggles between traditional mode and “copy-friendly” mode)
@bezerraluiz commented on GitHub (Jan 28, 2026): Hello again, I updated the config.ts file and now the shortcut to clear the input is CTRL+L and the shortcut to copy to the console is CTRL+D. What do you think? I haven't submitted a pull request because I want to hear your opinion first. Now, when selecting output, you can use the shortcut CTRL+C and the action to automatically copy to the clipboard is still enabled. --- Documentation: # Shortcuts: Copy vs Exit ## Problem In OpenCode TUI, `Ctrl+C` is often used as a global shortcut for exit (`app_exit`). For those accustomed to `Ctrl+C` = copy, this can unintentionally close the CLI. ## Recommended Solution 1. **Remove `Ctrl+C` from the exit shortcut** (`keybinds.app_exit`) 2. **Use another shortcut for “clear input”** (e.g., `Ctrl+L`) 3. **Keep exit via `Ctrl+D`** ## Toggle quickly in TUI In the prompt, run: - `/togglecopy` (toggles between traditional mode and “copy-friendly” mode)
Author
Owner

@haimu0427 commented on GitHub (Jan 28, 2026):

I think it's A good job, is it a little complicated?
I think we can look at the success stories on the market. For example claude code and codex.
Thank you for providing me with a good idea, and I also hope to make a contribution to this reposipory.

@haimu0427 commented on GitHub (Jan 28, 2026): I think it's A good job, is it a little complicated? I think we can look at the success stories on the market. For example claude code and codex. Thank you for providing me with a good idea, and I also hope to make a contribution to this reposipory.
Author
Owner

@bezerraluiz commented on GitHub (Jan 28, 2026):

Good evening -- I don't know what the time is there. I made the change. If you want, we can exchange ideas, what do you think?

Or I can send you the code here if you prefer.

@bezerraluiz commented on GitHub (Jan 28, 2026): Good evening -- I don't know what the time is there. I made the change. If you want, we can exchange ideas, what do you think? Or I can send you the code here if you prefer.
Author
Owner

@haimu0427 commented on GitHub (Jan 28, 2026):

We're on opposite sides of the globe~😸, and it's still morning here,
so I'd love to take a look at your code.

@haimu0427 commented on GitHub (Jan 28, 2026): We're on opposite sides of the globe~😸, and it's still morning here, so I'd love to take a look at your code.
Author
Owner

@bezerraluiz commented on GitHub (Jan 28, 2026):

Yess, should I send the code here or do you have another way to communicate?

@bezerraluiz commented on GitHub (Jan 28, 2026): Yess, should I send the code here or do you have another way to communicate?
Author
Owner

@haimu0427 commented on GitHub (Jan 28, 2026):

Just go here, or contact me haimu0427@Outlook.com . Actually, I'm not familiar with what social programs you guys use 🥲

@haimu0427 commented on GitHub (Jan 28, 2026): Just go here, or contact me [haimu0427@Outlook.com](mailto:haimu0427@Outlook.com) . Actually, I'm not familiar with what social programs you guys use 🥲
Author
Owner

@bezerraluiz commented on GitHub (Jan 28, 2026):

I was looking at the changes and it would be easier if you took a look at the commit on the branch.

https://github.com/bezerraluiz/opencode/commit/0c68f4eeaeb52675f10ead4fa63c6f10c55d018a

Branch:

https://github.com/bezerraluiz/opencode/tree/issue-10975

@bezerraluiz commented on GitHub (Jan 28, 2026): I was looking at the changes and it would be easier if you took a look at the commit on the branch. https://github.com/bezerraluiz/opencode/commit/0c68f4eeaeb52675f10ead4fa63c6f10c55d018a Branch: https://github.com/bezerraluiz/opencode/tree/issue-10975
Author
Owner

@haimu0427 commented on GitHub (Jan 28, 2026):

Good night bro, get some rest

@haimu0427 commented on GitHub (Jan 28, 2026): Good night bro, get some rest
Author
Owner

@bezerraluiz commented on GitHub (Jan 28, 2026):

Thank you bro, enjoy your day. If you need anything, you can call me here.

If you'd like to exchange ideas about the issue, feel free to contact me and we'll figure out the best way for everyone to use it.

@bezerraluiz commented on GitHub (Jan 28, 2026): Thank you bro, enjoy your day. If you need anything, you can call me here. If you'd like to exchange ideas about the issue, feel free to contact me and we'll figure out the best way for everyone to use it.
Author
Owner

@haimu0427 commented on GitHub (Jan 30, 2026):

This is a very good work, I also have a suggestion, in order to prevent accidental interruptions, we can not press the next time to exit, in the page to make a prompt whether to exit or not

@haimu0427 commented on GitHub (Jan 30, 2026): This is a very good work, I also have a suggestion, in order to prevent accidental interruptions, we can not press the next time to exit, in the page to make a prompt whether to exit or not
Author
Owner

@bezerraluiz commented on GitHub (Jan 31, 2026):

Is this true when using the default shortcut or the new one from my change?

@bezerraluiz commented on GitHub (Jan 31, 2026): Is this true when using the default shortcut or the new one from my change?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7828