rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.58k stars 2.39k forks source link

ansi escape codes not being omitted in vim shell #5872

Open slmjkdbtl opened 6 years ago

slmjkdbtl commented 6 years ago
1533646617

the ansi escape characters are not omitted, while other programs with color output works fine?

alexcrichton commented 6 years ago

Currently Cargo doesn't do detection to see whether the shell supports colors, it simply checks $TERM != "dumb" and whether the output is a tty, and if both of those are true it emits colors.

Could vim be configured to set TERM=dumb if it doesn't support ansi codes?

refaelsh commented 3 years ago

+1

epage commented 11 months ago

At this point, we check

Note: this is using anstyle-query and matches termcolors behavior with the last two items which is what ripgrep uses

Looking at another crate, supports-color, instead of assuming any terminal supports color if it isn't TERM=dumb, it checks a specific list of term values / prefixes. As t his whole area is a hodgepodge, its hard to tell what is the most appropriate route to take.

epage commented 11 months ago

Hmm, I just did !echo $TERM and I got back the result for my own terminal which means we don't have anything to go off of. This was with vim 8.2.213.

Is there anything we can even do for this? Are there examples of other programs that work better with vim that we could learn from?

btw we also have #11211 for changing TERM detection