Repository navigation
Commit f203b17
jeankrlo2929
fix(tui): reset terminal state on crash/exit (Windows)
On Windows, when OpenCode exits unexpectedly or crashes, the terminal
is left in a broken state showing raw ANSI escape sequences as literal
text (e.g. "555;59;86m") and the cursor may be hidden.
Add resetTerminal() in thread.ts and attach.ts that:
- Sends \x1b[0m to reset all ANSI attributes (colors, bold, etc.)
- Sends \x1b[?25h to restore the cursor
- Sends \x1b[?1049l to exit the alternate screen buffer
- Sends \x1b[?7h to re-enable auto-wrap
Also registers a process.on("exit") handler in thread.ts as a
backstop that runs even on process.exit() or uncaught exceptions.
Fixes: anomalyco#212771 parent 3c96bf8 commit f203b17
2 files changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
9 | 19 | | |
10 | 20 | | |
11 | 21 | | |
| |||
83 | 93 | | |
84 | 94 | | |
85 | 95 | | |
| 96 | + | |
86 | 97 | | |
87 | 98 | | |
88 | 99 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
24 | 37 | | |
25 | 38 | | |
26 | 39 | | |
| |||
226 | 239 | | |
227 | 240 | | |
228 | 241 | | |
| 242 | + | |
229 | 243 | | |
230 | 244 | | |
231 | 245 | | |
| |||
0 commit comments