Skip to content
New issue

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

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

Already on GitHub? # to your account

Colorize edit/del indicators #1

Open
notramo opened this issue Jun 7, 2018 · 4 comments
Open

Colorize edit/del indicators #1

notramo opened this issue Jun 7, 2018 · 4 comments

Comments

@notramo
Copy link

notramo commented Jun 7, 2018

+ - ~ should be colorized on line start (~ should be yellow or blue?).

@nixn
Copy link
Owner

nixn commented Jun 8, 2018

I thought of yellow, but blue is also a nice option. But I did not colorize the ~ because I don't check whether there was color enabled. git-diffw could be also used on non-colored diffs, so simply adding an ASCII color code on output would break things up. A recognition of the color option would be needed, but as it was not my primary concern, I left it out when intially writing that code.

The colorization of + and - is preserved (the full input - that's with color codes - is just copied to the output).

@notramo
Copy link
Author

notramo commented Jun 8, 2018

I forgot passing --color option to git diff, so line additions/deletions weren't coloured.
What about colorizing the unchanged parts in the entire line with yellow/blue where only words changed?

@nixn
Copy link
Owner

nixn commented Jun 9, 2018

This is again controlled by git. The in-line changes are produced by git diff --color-words, the result is shown unchanged in the ~ line. I don't know of a way to color unchanged parts in that in-line diff with git-own methods. Perhaps it could be hacked in some way (searching for color codes or something like that and adding own color codes), but it probably would be error prone.

Perhaps someone could help with that, I would happily accept a PR.

@nixn
Copy link
Owner

nixn commented Jun 9, 2018

Beside of the above comment, coloring the indicator ~ should be easy, but I need to think about implications when using color codes. But since git diff --color-words implies --color, I think the addition of color codes around ~ would not break anything (more). But that shows that using --color is perhaps the wrong way, it should be --word-diff=plain for non-colored diffs. That's why recognition of color usage is needed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants