WinMerge / winmerge

WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
https://winmerge.org/
GNU General Public License v2.0
6.15k stars 784 forks source link

Substitution filters break with line filters #2233

Open OshidaBCF opened 4 months ago

OshidaBCF commented 4 months ago

I have two filters, one is a line filter "hp": \d*\.?\d* just to ignore and "hp" changes

the other is a filter to ignore an addition \n },\n "transmission": {\n "armorThrough": 50.0,\n "fireParamsPreset": "ship_engine",\n "armorClass": "armor_tank_engine",\n "armorThickness": 4.0,\n "fireProtectionHp": 10.0

image

The substitution filter is supposed to ignore the addition of the "transmission" block, but because the line just above is a "hp" change the different is actually larger

If i disable line filters this show up image

And the comma isn't in the same difference as the "transmission" block

if i change the hp value to 760, the transmission filter works image

i do not know exactly how it works, but i guess that both filters try to apply at the same time or on the same text, and it break somewhere

old.txt new.txt

sdottaka commented 4 months ago

I haven't investigated the reason yet, but mixing Line filters and substitution filters may not work, so how about changing Line filter to Substitution filter as shown below? In addition, in the current version, it was necessary to change \n in the second Substitution filter to \r\n for attached files.

image

OshidaBCF commented 4 months ago

I tried by pure luck to change line to substitution, and it worked perfectly

i didn't needed to add the \r, maybe because i have the "Cariage return difference" turned off

i should start using only substitution, because they can work on multiple lines they are much stronger than regular line filters