cwdiff icon indicating copy to clipboard operation
cwdiff copied to clipboard

Fixes parsing of `wdiff` output

Open wesalvaro opened this issue 7 years ago • 8 comments

Fixes #6

wesalvaro avatar Jun 25 '18 04:06 wesalvaro

Thanks for the report and the fix, I will test this on OSX, whose sed is slightly different, and then merge it.

junghans avatar Jun 25 '18 13:06 junghans

Hmm, OSX it says:

": RE error: repetition-operator operand invalid

replace .*? to something like .* works, so it seems BSD sed doesn't implement .*? even with -E.

junghans avatar Jun 25 '18 16:06 junghans

It might be better to replace the whole color_filter() with wdiff -w "$RED" -x "$OFF" -y "$GREEN" -z "$OFF".

junghans avatar May 06 '24 15:05 junghans

Yes, I think so, too. AFAICS, only wdiff knows where the diffs start and end, and parsing the output of wdiff will fail, even with non-greedy regular expressions – you can always construct input that clashes with -] and siblings.

lemzwerg avatar May 09 '24 15:05 lemzwerg

As a corollary it is probably necessary to remove the --filter option because it cannot be implemented reliably.

lemzwerg avatar May 09 '24 15:05 lemzwerg

Yes, I think so, too. AFAICS, only wdiff knows where the diffs start and end, and parsing the output of wdiff will fail, even with non-greedy regular expressions – you can always construct input that clashes with -] and siblings.

Or, we inject out own markers and replace those, but as you said one can always construct a clash.

As a corollary it is probably necessary to remove the --filter option because it cannot be implemented reliably.

Yeah not sure if anybody has ever used that.

junghans avatar May 09 '24 15:05 junghans