Skip to content
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

Add coloured deep diffs #1279

Open
alexharv074 opened this issue Dec 25, 2022 · 7 comments
Open

Add coloured deep diffs #1279

alexharv074 opened this issue Dec 25, 2022 · 7 comments

Comments

@alexharv074
Copy link
Contributor

alexharv074 commented Dec 25, 2022

Subject of the issue

See #1261

Steps to reproduce

A deep diff like this one also should be coloured:
screen_shot_2022-11-22_at_1 54 32_pm

@alexharv074
Copy link
Contributor Author

An implementation similar to #1261 should work but I will assume a line beginning with 12 spaces then a minur or plus gets coloured.

@jfalkenstein
Copy link
Contributor

Interesting. You'd need to have a recursive function that finds keys with the name of diff. It'd be a bit tricky, but possible.

@alexharv074
Copy link
Contributor Author

alexharv074 commented Dec 28, 2022

@jfalkenstein I am stumped. Your comment in the code mentions:

PyYaml disallows block styling for multiline strings if any of the lines has a space followed
by a line break.

I have found that if I insert any Fore colour code into the string the block styling is broken. Do you recall where you found the details about trailing spaces, or do you have any other ideas for how this could be done?

@jfalkenstein
Copy link
Contributor

I believe I ran into this behavior through testing and following the debugger deep, deep into PyYaml code. Why? Is this proving a problem for you?

@alexharv074
Copy link
Contributor Author

@jfalkenstein Yes, it's proving to be a problem. Without delving as far into the internals of PyYaml, I think it is almost impossible. Any insertion of a colour code into the string causes PyYaml to not use the block styling.

@jfalkenstein
Copy link
Contributor

Yeah, I remember that being an ugly dungeon of deep recursion...

@jfalkenstein
Copy link
Contributor

HOWEVER, I think rather than doing that, I think it might be a better idea to apply the coloring AFTER the code comes out of py-yaml.

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

No branches or pull requests

2 participants