-
Notifications
You must be signed in to change notification settings - Fork 393
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
🚀Extended plain mode coloring options #168
Comments
Hi @da-x, I really like the idea of coloring the commit messages! However I'm not totally sure, whether this is really
Here is a first quick attempt to match your example (I guess extending the background color to the end of the line should also somehow work): IMHO it will be quite hard (aka. impossible) for
|
@0xC0FFEE, yeah I agree that if Git was a bit more featureful we wouldn't need to parse and recolor its output. Your suggestion looks cool, but I still prefer the indented commit body message (no alternative to BTW, in my draft changes I modified the parsing a slight bit - detecting where the commit header ends upon detecting a blank line. As it stands |
@da-x great, I'm happy to have some other collaborators on the code! Modulo the current discussion, I have one initial question about the code changes: is there some refactoring of the state machine parser that you see that could be done first, to make the introduction of the new features as clean as possible? @da-x @0xC0FFEE Do you think there's a good (and not too complex) solution where we can have both? Delta's purpose is to give people a lot of possibilities in designing their own git output styling, and I think it's OK to implement some things that overlap with what advanced users can achieve with git formatting operations. Defaults is another question of course. So doing both would be something like
If I'm understanding correctly, the concern is how we handle the conflict between people who are using git's native formatting and want Delta to pass on their input unchanged, vs people who are using default git formatting and will be happy for Delta to apply its own colors (stripping any ANSI sequences from the input in the process). But is that not basically resolved by the assumption
?
Well I hope so, you'd lose a lot of features otherwise! To make the discussion completely clear for all readers though, I believe @0xC0FFEE was suggesting that you use delta, but that the coloring is achieved by (a) a git log format, and (b) delta being good about passing on ANSI sequences unchanged wherever possible. |
@dandavison while editing the code I had to copy some logic pertaining to the whole-line background handing in diff hunks. Apart from that, I saw no need for any per-line state machine change besides commit meta-data header end detection. As of today, I started to use I agree that we should let Git's color styling to pass through as long as the user did not specify otherwise. However my draft is not supporting it, as it strips colors in Only Git knows what is the type of the ref (e.g. tag or branch), and it is colored accordingly, so we must preserve these colors. Depending on what the user specified, we may need to do a composite of delta's |
I think the easiest and least complicated solution would be to let the user specify the desired functionality (e.g. via a command line switch). So basically
Maybe (and just maybe) this decision could be made automatically based on the parsed text. However parsing things, were the input can be arbitrary text, might be (too) complicated.
I think supporting both use cases is desirable. However as we do not have any context, except for the text-based diff itself, it will be quite hard to support both use cases automatically IMHO. That is why I thought maybe we can get away with only implementing one of the use cases in
Indentation can be achieved via the
And as I've written before, arbitrary ANSI escape sequences can be printed via |
@da-x I haven't forgotten about the additions in your branch. I'd like to incorporate them to make more elements stylable. I did however completely change the master branch as you may have noticed. I hope you'll approve of the more consistent style CLI and internal data structures, but sorry to make your changes need recasting! I'll be happy to help out; one task is decide on what new styles we want to add I think. And I also need to circle back and think about the issue we discussed in this ticket of when delta does native color pass-through. |
Thanks for working on this. The changes look cool. We'd still need to see whether |
@da-x: the @da-x, @0xC0FFEE: all stylable elements now support If Here's an attempt at recreating the screenshot in this ticket using the new features in delta
The main things we're missing are:
Comments:
@da-x: sorry if I haven't understood yet what you were saying about |
Yes, I meant that with
|
I have a working draft (branch) for plain-mode extensions which adds coloring for further aspects of the diff. Hopefully I did not butcher the parsing code too much. Hoping to open a discussion about this to see that I'm taking the right direction.
This makes it look more like my old fancydiff, which I want to retire. I added 4 options:
The text was updated successfully, but these errors were encountered: