Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansi escape codes not being omitted in vim shell #5872

Open
slmjkdbtl opened this issue Aug 7, 2018 · 4 comments
Open

ansi escape codes not being omitted in vim shell #5872

slmjkdbtl opened this issue Aug 7, 2018 · 4 comments
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

Comments

@slmjkdbtl
Copy link

slmjkdbtl commented Aug 7, 2018

1533646617

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

@alexcrichton
Copy link
Member

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?

@ehuss ehuss added the A-console-output Area: Terminal output, colors, progress bar, etc. label Sep 23, 2019
@refaelsh
Copy link

refaelsh commented Dec 5, 2020

+1

@epage
Copy link
Contributor

epage commented Oct 23, 2023

At this point, we check

  • CLICOLOR, NO_COLOR, CLICOLOR_FORCE
  • TERM=dumb
  • Whether stdout is TTY

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
Copy link
Contributor

epage commented Oct 23, 2023

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

@epage epage added the S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Projects
None yet
Development

No branches or pull requests

5 participants