Ctrl-C Bug Report #8355

Open
opened 2026-02-16 18:09:45 -05:00 by yindo · 3 comments
Owner

Originally created by @WingSky2022 on GitHub (Feb 2, 2026).

Originally assigned to: @kommander on GitHub.

Description

OpenCodeCLI Bug Report

🐛 Bug Description

When using the Ctrl+C keyboard shortcut in the terminal, neither the copy operation works nor does the program exit normally. Instead, a large amount of garbled text is output to the terminal. This garbled text continues to increase as the mouse wheel is scrolled, severely affecting the terminal user experience.

🎯 Expected Behavior

When Ctrl+C is pressed, the program should be able to:

  • Copy operation: Execute copy when text is selected
  • Interrupt operation: Press the shortcut twice to exit CLI state
  • Clear output: Maintain clear and readable terminal output

Actual Behavior

  • Ctrl+C does not trigger the copy function
  • The program cannot exit normally
  • Large amount of garbled characters appears in the terminal (see screenshot below)
  • Garbled text continues to increase with mouse wheel scrolling

🖥️ Environment Information

  • Operating System: Windows 11 (version not specified)
  • OpenCodeCLI Version: v1.1.48 (latest version)
  • Terminal Type: PowerShell
  • PowerShell Version: [To be supplemented, can be viewed via $PSVersionTable.PSVersion]

🔍 Preliminary Analysis

This issue may be related to the following factors:

  1. Signal Handling Issue: OpenCodeCLI may not properly handle the SIGINT signal on Windows
  2. Terminal Control Sequences: The program may be outputting ANSI escape sequences that are not correctly parsed
  3. Encoding Issue: Mismatch between terminal character encoding and program output encoding
  4. PowerShell Compatibility: The program may not have been adequately tested in PowerShell environment

📝 Additional Information

Impact Scope:

  • This issue still exists in the latest version (1.1.48)
  • Affects basic terminal interaction operations (copy, interrupt)
  • Reduces tool usability and user experience

Testing Suggestions:

  • Suggest testing in other terminal environments (CMD, Windows Terminal, Git Bash) to see if it reproduces
  • Suggest testing on different operating systems (macOS, Linux) to determine if it's a Windows-specific issue

🚀 GitHub Issue Submission Suggestion

When submitting to GitHub, suggested title:

[Bug] Ctrl+C triggers garbled text and cannot properly interrupt program on Windows 11 PowerShell

Tag suggestions: bug, windows, terminal, priority: high


Document created: 2026-02-03
OpenCodeCLI Version: 1.1.48

Plugins

oh-my-opencode

OpenCode version

OpenCodeCLI Version: v1.1.48

Steps to reproduce

💡 Steps to Reproduce

  1. Open PowerShell terminal on Windows 11 system
  2. Launch OpenCodeCLI (version 1.1.48)
  3. Press the Ctrl+C keyboard shortcut while the program is running
  4. Observe garbled text output in the terminal

Screenshot and/or share link

📸 Related Screenshot

Image

Operating System

Windows 11

Terminal

PowerShell

Originally created by @WingSky2022 on GitHub (Feb 2, 2026). Originally assigned to: @kommander on GitHub. ### Description # OpenCodeCLI Bug Report ## 🐛 Bug Description When using the `Ctrl+C` keyboard shortcut in the terminal, neither the copy operation works nor does the program exit normally. Instead, a large amount of garbled text is output to the terminal. This garbled text continues to increase as the mouse wheel is scrolled, severely affecting the terminal user experience. ## 🎯 Expected Behavior When `Ctrl+C` is pressed, the program should be able to: - **Copy operation**: Execute copy when text is selected - **Interrupt operation**: Press the shortcut twice to exit CLI state - **Clear output**: Maintain clear and readable terminal output ## ❌ Actual Behavior - `Ctrl+C` does not trigger the copy function - The program cannot exit normally - Large amount of garbled characters appears in the terminal (see screenshot below) - Garbled text continues to increase with mouse wheel scrolling ## 🖥️ Environment Information - **Operating System**: Windows 11 (version not specified) - **OpenCodeCLI Version**: v1.1.48 (latest version) - **Terminal Type**: PowerShell - **PowerShell Version**: [To be supplemented, can be viewed via `$PSVersionTable.PSVersion`] ## 🔍 Preliminary Analysis This issue may be related to the following factors: 1. **Signal Handling Issue**: OpenCodeCLI may not properly handle the `SIGINT` signal on Windows 2. **Terminal Control Sequences**: The program may be outputting ANSI escape sequences that are not correctly parsed 3. **Encoding Issue**: Mismatch between terminal character encoding and program output encoding 4. **PowerShell Compatibility**: The program may not have been adequately tested in PowerShell environment ## 📝 Additional Information **Impact Scope**: - This issue still exists in the latest version (1.1.48) - Affects basic terminal interaction operations (copy, interrupt) - Reduces tool usability and user experience **Testing Suggestions**: - Suggest testing in other terminal environments (CMD, Windows Terminal, Git Bash) to see if it reproduces - Suggest testing on different operating systems (macOS, Linux) to determine if it's a Windows-specific issue --- ## 🚀 GitHub Issue Submission Suggestion When submitting to GitHub, suggested title: ``` [Bug] Ctrl+C triggers garbled text and cannot properly interrupt program on Windows 11 PowerShell ``` **Tag suggestions**: `bug`, `windows`, `terminal`, `priority: high` --- *Document created: 2026-02-03* *OpenCodeCLI Version: 1.1.48* ### Plugins oh-my-opencode ### OpenCode version OpenCodeCLI Version: v1.1.48 ### Steps to reproduce ## 💡 Steps to Reproduce 1. Open PowerShell terminal on Windows 11 system 2. Launch OpenCodeCLI (version 1.1.48) 3. Press the `Ctrl+C` keyboard shortcut while the program is running 4. Observe garbled text output in the terminal ### Screenshot and/or share link ## 📸 Related Screenshot <img width="1094" height="292" alt="Image" src="https://github.com/user-attachments/assets/20a549ae-b85d-4006-9c0f-a2ad38325503" /> ### Operating System Windows 11 ### Terminal PowerShell
yindo added the windowsopentuibug labels 2026-02-16 18:09:45 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 2, 2026):

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

  • #7062: Pressing Ctrl+C in input field outputs ANSI escape sequences/garbled text
  • #10538: Ctrl-C doesn't clear the input on Windows, it crashes
  • #9183: Bug: Ctrl+C causes serialization issues in CLI TUI version
  • #11748: After closing the OpenCode CLI, scrolling the mouse wheel and moving the mouse in the powershell will cause garbled characters
  • #10783: OpenCode Crashes then outputs garbled tokens
  • #8908: In version 1.1.23, the issue of the mouse wheel triggering abnormal ASCII codes after exiting reappeared
  • #6912: Ctrl+C does not disable mouse tracking, causing raw escape sequences to flood terminal (Windows)
  • #7074: [Windows] CTRL_C_EVENT not handled by bun (umbrella issue)

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

@github-actions[bot] commented on GitHub (Feb 2, 2026): This issue might be a duplicate of existing issues. Please check: - #7062: Pressing Ctrl+C in input field outputs ANSI escape sequences/garbled text - #10538: Ctrl-C doesn't clear the input on Windows, it crashes - #9183: Bug: Ctrl+C causes serialization issues in CLI TUI version - #11748: After closing the OpenCode CLI, scrolling the mouse wheel and moving the mouse in the powershell will cause garbled characters - #10783: OpenCode Crashes then outputs garbled tokens - #8908: In version 1.1.23, the issue of the mouse wheel triggering abnormal ASCII codes after exiting reappeared - #6912: Ctrl+C does not disable mouse tracking, causing raw escape sequences to flood terminal (Windows) - #7074: [Windows] CTRL_C_EVENT not handled by bun (umbrella issue) Feel free to ignore if none of these address your specific case.
Author
Owner

@epidemicz commented on GitHub (Feb 10, 2026):

There are a number of duplicates of this issue, but this is the best written one I have seen so far. I think it is important to point out there's definitely a separate but related issue where opencode will crash mid-processing and leave you in the same raw-input mode (perhaps see this ticket: https://github.com/anomalyco/opencode/issues/10783)

Control + C on Windows Terminal seems to reproduce it quite often.

As a pseudo work-around, I found that choosing Restart Connection from the Windows Terminal command palette (Control + Shift + P) will restore the terminal back to a good state. Calling opencode immediately after that requires me to resize the window for opencode to draw correctly, but that's really not an issue.

@epidemicz commented on GitHub (Feb 10, 2026): There are a number of duplicates of this issue, but this is the best written one I have seen so far. I think it is important to point out there's definitely a separate but related issue where opencode will crash mid-processing and leave you in the same raw-input mode (perhaps see this ticket: https://github.com/anomalyco/opencode/issues/10783) Control + C on Windows Terminal seems to reproduce it quite often. As a pseudo work-around, I found that choosing `Restart Connection` from the Windows Terminal command palette (Control + Shift + P) will restore the terminal back to a good state. Calling opencode immediately after that requires me to resize the window for opencode to draw correctly, but that's really not an issue.
Author
Owner

@osamaAbumansour commented on GitHub (Feb 16, 2026):

in my case,

this happens during a session, opencode will output that the process is killed , but the opencode cli is still running and in the input field it writes text as the image in the original post when i move or scroll the mouse.
the workaround , kill the terminal -> start it again -> run opencode -c

running opencode in wsl2 on windows 11
opencode version 1.2.5

@osamaAbumansour commented on GitHub (Feb 16, 2026): in my case, this happens during a session, opencode will output that the process is killed , but the opencode cli is still running and in the input field it writes text as the image in the original post when i move or scroll the mouse. the workaround , kill the terminal -> start it again -> run opencode -c running opencode in wsl2 on windows 11 opencode version 1.2.5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8355