6

When using WinMerge I am looking at a file that has had a block of code inserted into a function which causes the rest of the file to be out of sync in the comparison. Mine is much more complex but essentially the same as the simple example below:

  FILE 1                   FILE 2
1 int main() {             int main() {
2
3   int a = 3;               int a = 3;
4   a += 5;                  for(int i = 0; i < a; ++a)
5 }                             a += i;
6                           
7                            a += 5;
8                         }

WinMerge instead of recognizing the for-loop as an inserted block and showing the rest of the file the same it would show differences on line 4,5,6,7,8. I would expect it to sync line 4 of file 1 to line 7 of file 2 and make it a much cleaner diff. Is there a setting for this? I have played with the "Moved Code Block" setting but it simply highlights the matching code block later in the file instead of lining them up.

Any suggestions?

jterm
  • 973
  • 1
  • 12
  • 32

2 Answers2

1

try this instead, Menu merge->Add Synchronization Point (Alt+s) can solve your problem.

  • Thanks! The same result is possible in Beyond Compare with `F7` but my client doesn't want to spring for a closed-source merge tool, so I'm learning and teaching them WinMerge. – Rich Moss Jun 16 '23 at 08:22
0

I know what you mean, but your example worked for me.

I have the problem when the compare syncs up on say, blank lines.

I'm looking into the line filter...

Rufus
  • 51
  • 2
  • Thanks, for the follow up. The example I listed is pretty simplistic and it may actually work. But on a large file with many changes along with larger blocks of code changes like the one I listed it essentially calls the whole file different making the tool useless. – jterm Apr 11 '13 at 14:47
  • A minimal working example would be useful here. Some of these diff issues come down to subtle changes like carriage returns, length of the line, etc. – Jess Riedel Dec 10 '14 at 20:56