VTE is a Terminal Emulator library/widget for GTK+. VTE can be used to create terminal emulators or to embed a terminal in games, editors, IDEs etc.


VTE’s escape sequence parsing is notoriously bad. VTE is unable to ignore escape sequences it doesn’t know about, instead it just blurts them out adding garbage to your terminal screen.

This has been a known issue for over 10 years now with nobody willing to touch the related code with a ten foot pole. #403130

This behavior is different to every non-VTE terminal emulator I’ve come across which is exactly why it’s caused issues in various programs and scripts.

Edit: As of me writing this blog post, someone has taken on the task of rewriting the escape sequence parser. yay! #791636


This issue affected iTerm2, a terminal emulator for macOS. iTerm2 has a shell integration script which lets it read command history etc. iTerm2 also has it’s own proprietary escape sequences which it uses in the script.

You can see where I’m going with this. It basically blurted out the sequence in VTE terminals since it was unsupported.

The issue was “solved” not by patching the shell integration script but by patching VTE to interpret and swallow the proprietary sequence. #3c56e2c


One of my projects makes heavy use of some rather unknown escape sequences. More specifically it makes use of the sequences that allow for changing the terminal emulator’s color palette. pywal

I don’t just mean changing the text colors temporarily, I mean changing the colorscheme/theme of the terminal.

Now, VTE does support all but one of these escape sequences. The issue is the one sequence it doesn’t support.

The reason I’m writing this blog post is because I’ve found a workaround to this issue. I’ve found a way to swallow unknown sequences using a sequence of sequences (heh).


This is the workaround I’ve come up with. It successfully hides the unknown sequence without disrupting the terminal emulator or any underlying applications.


Here’s how it works:

\033[s                 # Save the cursor position.
\033[1000H             # Move the cursor off screen.
\033[8m                # Conceal the text.
\033]708;#000000\033\\ # Unknown sequence.
\033[u                 # Restore the cursor position.

This took a lot of trial and error and I’m still surprised that this works at all. It really shouldn’t. ¯\_(ツ)_/¯