language-diff icon indicating copy to clipboard operation
language-diff copied to clipboard

add more color and regexps:

Open anyaharter97 opened this issue 7 years ago • 5 comments

add header tag to index

add regexps for:

  • files overview
  • new file mode line
  • deleted file mode line
  • mail header

add color to:

  • range and coordinates
  • header
  • meta separater
  • mail header

anyaharter97 avatar Jul 17 '18 13:07 anyaharter97

Hello! Thanks for contributing. Any chance you can provide some more context, as well as adding some test cases to validate these behaviors?

miketheman avatar Jul 19 '18 03:07 miketheman

In the example I made the colors might seem like a lot in your face but on changes with more than just one line, the color of the headers and ranges make it easier to find the boundaries between commits

The mail header color is just to set it slightly apart from the rest of the file

The newfile and deletefile modes did not used to match the color of the header which seemed off to me so that is fixed in this patch

I guess I just thought it would be pretty to color the pluses and minuses in the file overview part because I've seen that somewhere before

I created an example patch demonstrating the changes I made but I don't know how to attach it to this...

anyaharter97 avatar Jul 30 '18 15:07 anyaharter97

0001-Example-commit.patch.txt

I added a txt extension to it that hopefully you can just delete and it will behave the same?

anyaharter97 avatar Jul 30 '18 15:07 anyaharter97

Hi @anyaharter97 ! Thanks for explaining further and providing an example.

I tried out the patch, and I think there's some considerations that aren't captured - could you take a pass at adding specs for the situations added in the diff.cson captures?

Here's an example of a spec that confirms a specific capture is being categorized correctly: https://github.com/miketheman/language-diff/blob/37b7dfb6ec4f3b154929b26050a0df10e65cb66b/spec/diff-spec.coffee#L35-L39

This becomes helpful to leverage when tweaking regexps - and you can run the tests via apm test or TravisCI will execute them on git push to your branch.

Also - curious why you would add new regexps for things that don't have colors added to them - are you using the scope for something else?

miketheman avatar Aug 02 '18 12:08 miketheman

With the regexps that don't have colors associated, I'm not entirely sure which ones you are referring to. I split up the regexps for the "mail" lines according to what I thought different categories were and which lines had colors in my command line editor. For example, I have attached a screenshot of the coloring for the top of the example patch in vim. vimcoloring In terms of splitting up the lines, I just figured it would be better to have back-references to pieces that fit easily into categories that could be colored later if desired.

anyaharter97 avatar Aug 02 '18 13:08 anyaharter97