michaelb/sniprun

Escape code not stripped maybe?

ryuheechul opened this issue · 4 comments

Describe the bug
Escape code not stripped

To Reproduce
Steps to reproduce the behavior:

  1. Open a typescript file containing '1+1'
  2. Run the command ':SnipRun'
  3. See error escape code contained as below
1+1 <- ^[[33m2^[[39m

Expected behavior

I expect no escaped code like this in virtual text, 1+1 <- 2 instead

Screenshots
Screenshot 2023-03-09 at 9 50 08 PM

Environment:

Additional context

Additional context

Screenshot 2023-03-09 at 11 16 12 PM

It looks like sometimes it doesn't have escape code and sometimes do.
For the particular screenshot above, the difference seems whether it's wrapped in console.log in the same line or not.

Hey, thanks for the bug report

So I assume you're in REPL mode ?
I probably forgot to pass options to the actual REPL to tell it not to color its stdout

Looking into this this weekend

Fix shouldn't be long, and I'll be putting out a new version (v1.2.11) soon

Meanwhile, you can export the environnement variable NO_COLOR=1 which is respected by deno to no output ANSI color codes in its REPL (used directly by sniprun)

Sorry for the delayed response, yes it was for the deno REPL. Just verified that the fix works like a charm, thanks a lot!