iliazeus/vscode-ansi

Is it possible to get rid of these excess escape sequences?

holland11 opened this issue · 4 comments

In my ~/.zshrc I have

autoload -U colors
colors

PROMPT="%{$fg[yellow]%}%T %{$fg[cyan]%}%~"$'\n'"%{$fg[yellow]%}> "%{$'\e[00m'%}

This produces the output shown here
Screenshot 2023-02-14 at 1 15 35 PM

When I log my terminal buffer, this turns into
Screenshot 2023-02-14 at 1 16 17 PM

Using the ANSI Colors preview, it now looks like
Screenshot 2023-02-14 at 1 16 51 PM

which is certainly an improvement, but there are quite a few escape sequences still in here that make it hard to read. Is there a way with this extension (or could there be?) or any other way unrelated to this extension that I could conveniently get rid of them all?

Well I found a tool ansifilter that removes all ANSI escape sequences from a text file. This cleans up the log to be readable, but it obviously removes the escape sequences that this extension uses to add colours. It's the main thing I was after though (clean + readable).

There is a read-only preview mode that hides the escapes. Press F1 - ANSI Colors: Open Preview to open it.

Hiding the escapes while keeping the file editable and properly colored is currently not possible.

The extension only interprets/hides the Select Graphic Rendition escapes. This is by design.

The problem with some escapes showing up in the read-only preview should be fixed in the latest extension version.