winmerge icon indicating copy to clipboard operation
winmerge copied to clipboard

Substitution filters not working in WinMerge v2.16.12.0

Open Gitoffthelawn opened this issue 4 years ago • 5 comments

I tried substitution filters in WinMerge v2.16.12.0 x64 and could not get them to do anything. They take a long time to process, so they act like they are doing something, but there was no visible change in the output in either pane. To test, I simply tried changing all occurrences of a to test. I also tried a regex substitution of changing , (a comma) to ,\r\n, and that also didn't work.

See also: Problems with Substitution Filters #790 (I saw that issue report after writing this one, but it sounds like that issue is related, but may not be identical. I want to carefully read the reply from @sdottaka a couple more times and perform more testing.)

Gitoffthelawn avatar May 18 '21 07:05 Gitoffthelawn

Could you tell me the contents of the compared files?

I compared files with the following content, and the Substitution Filters seem to work as they should.

image

sdottaka avatar May 21 '21 13:05 sdottaka

@sdottaka What your screenshot shows is exactly what I was expecting. Besides creating the filter, and clicking "Enable" in the Filters dialog box, did you have to do anything else special to get it to work?

Regarding the contents of the files I compared... ooh, um, that was 4 days ago, and I've probably used WinMerge at least 200 times since then. :) I don't remember which files I was comparing, but I know I was comparing scores of modified JSON files (not quite JSON syntax, but very close). Most of those files did not have any CR or LF characters; perhaps that's a helpful clue.

Gitoffthelawn avatar May 22 '21 00:05 Gitoffthelawn

did you have to do anything else special to get it to work?

The Substitution filters settings I have made are only those shown in the screenshot above.

sdottaka avatar May 22 '21 13:05 sdottaka

I have the same issue: the filter doesn't seem to work. I use a regex as shown below image The regex should remove all descriptions from an XML document. But when I compare two XML files, I get image I would expect that the line SomethingElse is highlighted as a difference but that the Param1 line is not marked,

btw - When I remove the SomethingElse line then both files are seen as identical, i.e. in this case the substitution filter works.

allwi avatar Nov 25 '21 04:11 allwi

Unfortunately, there is a limitation in the substitution filters that are applied after the diff calculation.

I hope to fix this eventually, but it is unlikely to happen soon.

Instead, try using the PrediffLineFilter.sct plugin, which provides similar functionality.

This plugin is applied before the diff calculation, so you will get the expected results.

image image image image image

sdottaka avatar Nov 25 '21 11:11 sdottaka

@sdottaka I was never able to get the PrediffLineFilter plugin to work... the settings page never appears.

So I was experimenting with substitution filters again, and now have a pair of files that demonstrate very odd behaviour. The substitutions are never displayed in the output, but for a portion of the files, WinMerge correctly identifies that the substituted changes are to be ignored. Yet partway through the files, the substitution filter simply stops having any effect.

Gitoffthelawn avatar Jun 05 '23 02:06 Gitoffthelawn

Can you provide the contents of the Substitution filters and the pair of files? Also what version of WinMerge are you using?

sdottaka avatar Jun 05 '23 12:06 sdottaka

This issue was resolved with improvement in PR #2032.

sdottaka avatar Sep 20 '23 12:09 sdottaka

@sdottaka Thank you for fixing this, and my sincere apologies that I never responded to your June 5 comment. I'm not sure how the notification got removed, but it was gone on my end. Feel free to ping me if that ever happens again!

Gitoffthelawn avatar Sep 21 '23 08:09 Gitoffthelawn