echo -e "\ec" (ansi “OSC C”) erroneously clears the screen and destroys the scrollback buffer 😲 #22630

Closed
opened 2026-01-31 08:18:59 +00:00 by claunia · 2 comments
Owner

Originally created by @ClaireCJS on GitHub (Dec 9, 2024).

Windows Terminal version

1.22.3232.0

Windows build number

10.0.19045.5198

Other Software

ANSI emulation

Steps to reproduce

Send ansi OSC c command

echo -e "\ec"

(escape followed by c)

Expected Behavior

Resets font colors to their defaults.

Actual Behavior

It does the right thing BUT ALSO CLEARS THE SCREEN AND DESTROYS THE SCROLLBACK BUFFER.

Devestating.

It isn’t part of the ANSI standard to clear the screen and destroy the scrollback buffer there...

Originally created by @ClaireCJS on GitHub (Dec 9, 2024). ### Windows Terminal version 1.22.3232.0 ### Windows build number 10.0.19045.5198 ### Other Software ANSI emulation ### Steps to reproduce Send ansi OSC c command ``` echo -e "\ec" ``` (escape followed by c) ### Expected Behavior Resets font colors to their defaults. ### Actual Behavior It does the right thing BUT ALSO CLEARS THE SCREEN AND DESTROYS THE SCROLLBACK BUFFER. Devestating. It isn’t part of the ANSI standard to clear the screen and destroy the scrollback buffer there...
claunia added the Resolution-By-DesignNeeds-TriageIssue-BugNeeds-Author-Feedback labels 2026-01-31 08:18:59 +00:00
Author
Owner

@DHowett commented on GitHub (Dec 9, 2024):

The sequence you shared is called RIS, or "full reset"

ESC c Full Reset (RIS), VT100.
source

It's expected to fully reset the terminal hardware to its bootup configuration. It's absolutely part of the standard.

FWIW, that's not actually an OSC at all. Only sequences beginning with ESC ] are OSC!

@DHowett commented on GitHub (Dec 9, 2024): The sequence you shared is called `RIS`, or "full reset" > `ESC c` Full Reset (RIS), VT100. > _[source](https://www.invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Controls-beginning-with-ESC)_ It's expected to _fully_ reset the terminal hardware to its bootup configuration. It's absolutely part of the standard. FWIW, that's not actually an `OSC` at all. Only sequences beginning with `ESC ]` are OSC!
Author
Owner

@DHowett commented on GitHub (Dec 9, 2024):

You could always try DECSTR ("Soft terminal reset")

CSI ! p Soft terminal reset (DECSTR), VT220 and up.
source

@DHowett commented on GitHub (Dec 9, 2024): You could always try `DECSTR` ("Soft terminal reset") > `CSI ! p` Soft terminal reset (DECSTR), VT220 and up. > _[source](https://www.invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_)_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22630