Sceptre/sceptre

Add coloured deep diffs

alex-harvey-z3q opened this issue · 7 comments

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

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

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.

@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?

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?

@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.

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

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.