Skip to content

Terminal cursor disappears, outputs raw ANSI, after running (TUI?) scripts #308717

@mindplay-dk

Description

@mindplay-dk

I often run into this issue, where the terminal gets wonky after closing (CTRL+C) a TUI script.

Image

After hitting CTRL+C a few more times, I can get the terminal back to a semi-working state where I can type, and the cursor keys work, although the cursor itself remains invisible:

Image

Steps to Reproduce:

  1. Run TUI terminal scripts such as OpenCode or this AI hero course in a Bash terminal
  2. Stop the script using CTRL+C
  3. Observe that cursor is missing, up/down arrows keys print raw ANSI escape codes

In this state, I can't cursor up/down, it just prints what looks like ANSI escape codes.

It happens both in local WSL Bash sessions, and in a remote SSH tunnel sessions. (I'm not sure about Windows console sessions, because I don't use local Windows console sessions.)

Once the terminal is in this broken state, I just close the terminal and open a new one, and it works again.

My wild guess (I'm not an expert) is this happens because TUIs change the ANSI terminal mode or something? And perhaps most TUIs don't capture CTRL+C and clean up the terminal state on exit? It happens frequently after terminating any script that has a TUI of some sort. I don't know how other terminals behave, but would guess/assume after killing a task that most terminals would reset their mode somehow? I haven't had this experience in a local terminal on a Linux system.

Version info:

Version: 1.114.0 (user setup)
Commit: e7fb5e96c0730b9deb70b33781f98e2f35975036
Date: 2026-04-01T09:27:11Z
Electron: 39.8.3
ElectronBuildId: 13658728
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200

I'm on my Windows system at work right now, but I also use VS Code with local Bash sessions on my Linux system at home (Zorin 18, an Ubuntu based OS) where this problem also occurs regularly - so I don't believe the issue is whether it's a remote or local session.

I am always using plain Bash, all defaults, totally vanilla, no add-ons, no modified configuration, if that helps.

Metadata

Metadata

Assignees

Labels

confirmation-pendingterminal-inputRelating to typing in the terminal not doing the right thing, IMEs not working, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions