konradsz / igrep

Interactive Grep
MIT License
636 stars 17 forks source link

Preserve ANSI escape sequences #54

Open ncfavier opened 10 months ago

ncfavier commented 10 months ago

It would be nice to have an option to preserve ANSI escape sequences in the main view, similar to less's -r or -R flags. Currently it seems like the ESC characters are stripped, leaving only things like [94m[33m.

konradsz commented 4 months ago

Is it similar request to this one: https://github.com/BurntSushi/ripgrep/issues/519? If so, BurntSushi's response applies here as well.

ncfavier commented 4 months ago

No, ripgrep has the correct behaviour:

$ printf '\e[0;34mfoo\n' > foo
$ rg . foo # shows "foo" in blue
$ ig . foo # shows "[0;34mfoo"

That issue is about ignoring escape codes in search, i.e. interpreting those sequences and excluding them from the text. I am asking to leave the sequences alone so that they can be interpreted by my terminal.