Skip to content

Loading…

use of ansi-color-apply corrupts data #544

Closed
tarsius opened this Issue · 2 comments

1 participant

@tarsius
Magit member

Why does magit-cmd-output replace color control sequences with text properties and discard other control sequences? I believe git never colorizes it's output when it doesn't go to a terminal, but I might be wrong.

Anyways even if there are situations where we have to do something about control sequences it doesn't seem right to do it here. Sometimes control sequences should be left intact, e.g. when git's output is actually data tracked by it which happens to contain such sequences.

As an example clone git@github.com:emacsmirror/buster-mode.git. Then use magit-show to view buster-mode.el. Output is cut of in the middle of the file just before �^[[1A.

@tarsius
Magit member

It seems that converting color sequences to properties is done for the benefit of code that explicitly requests colored output. These callers should deal with this step themselves instead of having magit-cmd-output do it for every caller, some of which require the real data not some prettified representation of it.

(There is probably also a problem with ansi-color-apply: it doesn't seem right that it just stops at a control sequence. But that's a different issue.)

@tarsius tarsius added a commit that referenced this issue
@tarsius tarsius only translate ansi sequences to properties when needed
Only translate ansi control sequences to text properties when colored
git output was explicitly requested.  Previously this was done for all
git output and as a result e.g. `magit-show's output was corrupted
when the shown file contained such sequences.  Fixes #544.
1e74194
@tarsius tarsius added a commit that referenced this issue
@tarsius tarsius only translate ansi sequences to properties when needed
Only translate ansi control sequences to text properties when colored
git output was explicitly requested.  Previously this was done for all
git output and as a result e.g. `magit-show's output was corrupted
when the shown file contained such sequences.  Fixes #544.
4c46fd9
@tarsius tarsius added a commit that referenced this issue
@tarsius tarsius only translate ansi sequences to properties when needed
Only translate ansi control sequences to text properties when colored
git output was explicitly requested.  Previously this was done for all
git output and as a result e.g. `magit-show's output was corrupted
when the shown file contained such sequences.  Fixes #544.
351b6ae
@tarsius tarsius was assigned
@tarsius
Magit member

This is being worked on in #620, no need to have two issues open.

@tarsius tarsius closed this
@tarsius tarsius added a commit that referenced this issue
@tarsius tarsius only translate ansi sequences to properties when needed
Only translate ansi control sequences to text properties when colored
git output was explicitly requested.  Previously this was done for all
git output and as a result e.g. `magit-show's output was corrupted
when the shown file contained such sequences.  Fixes #544.
6bbebdf
@tarsius tarsius added a commit that referenced this issue
@tarsius tarsius only translate ansi sequences to properties when needed
Only translate ansi control sequences to text properties when colored
git output was explicitly requested.  Previously this was done for all
git output and as a result e.g. `magit-show's output was corrupted
when the shown file contained such sequences.  Fixes #544.
a404670
@tarsius tarsius added a commit that referenced this issue
@tarsius tarsius magit-cmd-output: do not corrupt output
This fixes #544.  There is no reason why we would want to manipulate
git's output.  In the master and next branches something similar to
the code removed in this commit was used to have colorful graphs in
logs.  But doing it in `magit-cmd-output' was wrong and that has been
fixed in these branches also.
c1de1fa
@tarsius tarsius added a commit that referenced this issue
@tarsius tarsius magit-cmd-output: do not corrupt output
This fixes #544.  There is no reason why we would want to manipulate
git's output.  In the master and next branches something similar to
the code removed in this commit was used to have colorful graphs in
logs, but in maint that isn't the case.
20c068f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.