-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
command should not output ANSI color codes when use_ansi_coloring
is disabled in config
#14194
Comments
I would expect it to work even if |
I can probably fix this:
The problem with the first method (as well as for |
@weirdan The problem is that any Nushell code that uses it (e.g., It's kind of ironic that it already does have logic built-in for it, but only for previews. |
We could have a flag to override the |
I also think |
The whole reason people have |
@weirdan Can you elaborate? Are you saying that someone would turn off I think:
Ultimately the most likely use case for |
No, I'm saying that most users (like 95% of them) shouldn't need |
That just seems to make the issue more intractable. The "should account for" -- Maybe they should, but I really doubt that's going to happen, and we already have several existence proofs for that. While And if they don't (and they aren't), then their output is going to display incorrectly for some users, most importantly those who need to disable it for accessibility reasons. We shouldn't then expect that end-user to have to go to each module author to ask them to fix it. And why even put the burden on the module author - Why make every command/prompt/whatever author have to special-case it when we can do it once at the source? Clearly the "whatever implements that" should be using |
Alternatively, I could see just recommending a |
Because the problem is not in the internal |
But the whole point of |
Describe the bug
This is the root cause of #14043.
In (unrelated to 14043) digging around in the
ansi
command, it comes to mind that the reason why user-land ANSI was still coloring output in #14043 is that theansi
command itself still outputs color codes, even whenuse_ansi_coloring
is false.This shouldn't happen.
The
ansi
command actually checks theuse_ansi_coloring
option, but only to determine if color previews should be shown withansi --list/-l
. It should also check before outputting a color (or attribute) code.How to reproduce
Note: to reproduce correctly, each line of the following must be executed separately; otherwise the environment won't be re-read before the command is executed ...
Expected behavior
I expect the
ansi
command to disregard color and attribute codes whenuse_ansi_coloring
isfalse
. ANSI codes related to cursor positioning, clearing the screen, and others should still be output.Configuration
The text was updated successfully, but these errors were encountered: