Wrong compare?

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
dexter@md
Junior Member
Junior Member
Posts: 8
Joined: 2007-01-22, 10:02 UTC

Wrong compare?

Post by *dexter@md »

Hi,

I have compared 2 text files.
TC founds differences in the line, but in the same line it shows also another "difference", wich is wrong (-20,258.38 is in the same position in both files, why is marked with red? The same with -1,100.00 text)

Screenshot:
http://img151.imageshack.us/img151/8647/wrongcompare9jk.jpg

And one feature I wrote about in another thread:
would be VERY usefull to have an option to save the differences to a specific file with options set by a checkboxes:
1. Include or not line numbers.
2. Include or not lines from source file
3. Include or not lines from destination files.

In case when 2 & 3 are on: first line is the source line, second line is destination line, 3rd - source, 4th - destination, etc.

In case that only one of 2 or 3 is on: save just the lines with the differences from the respective file only.

Usefull when compare text files.

Regards.
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3864
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

The difference could be at the space in front of the number (spaces or tabs)
Try to check the option "ignore repeated spaces" and re-compare ...
#5767 Personal license
dexter@md
Junior Member
Junior Member
Posts: 8
Joined: 2007-01-22, 10:02 UTC

Post by *dexter@md »

I tried - no difference.
But what difference can be between 2 spaces?
There are same number of spaces in front of numbers.
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3864
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

There are same number of spaces in front of numbers.
The room between the first difference and the 2nd one at the same line seems to be smaller (the first number is longer).
This let me guess that the number of spaces is different.
#5767 Personal license
dexter@md
Junior Member
Junior Member
Posts: 8
Joined: 2007-01-22, 10:02 UTC

Post by *dexter@md »

Correct, in second file we have longer text, but every line is formatted, so all figures starts in the same positions, just number of spaces differs.
Having this logic - text "(5 entries)" should be also highlighted, shouldn't it ?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately the compare text function is far from prefect. I did my best when I developped it (and I didn't steal any other people's code), but I simply cannot catch all possible situations. When a mismatch is found, TC tries to re-sync the two lines by searching for characters which match again.

In your special case I cannot say where the problem is without having the files.
Author of Total Commander
https://www.ghisler.com
dexter@md
Junior Member
Junior Member
Posts: 8
Joined: 2007-01-22, 10:02 UTC

Post by *dexter@md »

Hi Author of Total Commander, great job :)

The files are very simple. You can create by yourself:
File 1.txt
123(11)----------456----------789

File 2.txt
123/111(11)------456----------789

When I compare these lines:
1. "456" is highlighted.
But as You said, You are looking for characters which match again, and they do (as "(11)" text, which is not highlighted as difference and it's ok).
And "Ignore repeated spaces" checkbox does not help. Isn't it for these situations? 'cause we have different number of spaces in front of same "456" text.

2. the 4 "spaces" in front of 789 are highlighted... why ?

Screenshot:
Image: http://img184.imageshack.us/img184/9018/wrongcompare2yf4.jpg
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

OK, what happens here is the following:
1. TC finds the match "123"
2. It finds mismatch "(" and "/"
3. It finds again a match "(11)------", so "/111" is seen as
inserted text
4. It finds mismatch "-" and "4"
5. It finds again match "---", so "456" is seen as inserted text
6. It finds mismatch "4" and "-"
7. It finds again match "-----", so "456" in the other panel is seen as mismatch
etc.

So as you can see, "456" is found as a mismatch because the --- behind 456 in one panel match the --- before the 456 in the other panel.
Author of Total Commander
https://www.ghisler.com
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

I think dexter@md type dashes for visual purpose but you should replace each dash with one space and compare the two files

the following are four possibilties and their compare result:

file1.txt:

Code: Select all

123(11)          456          789
(10 spaces before 456)


file2.txt: can be one of the following four cases:

Code: Select all

123/111(11)       456          789
(7 spaces before 456) > 456 are not equal (colored RED in file2.txt)

Code: Select all

123/111(11)          456          789
(10 spaces before 456) > 456 are equal (colored BLACK in both files)

Code: Select all

123/111(11)             456          789
(13 spaces before 456) > 456 are not equal (colored RED in file1.txt)

Code: Select all

123/111(11)              456          789
(14 -or more- spaces before 456) > 456 are not equal (colored RED in both files)


it is supposed that when "Ignore repeated spaces" is checked, we get equal 456 in the above four cases
dexter@md
Junior Member
Junior Member
Posts: 8
Joined: 2007-01-22, 10:02 UTC

Post by *dexter@md »

ghisler,
Now I got the idea how it works and why we have mismatch.

ts4242 - thanks for the details - they are correct ;)
This was my second question to ghisler: why "Ignore repeated spaces" does not ignore them?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

why "Ignore repeated spaces" does not ignore them?
well, it usually does, but here you have a mismatch just before the dashes. Afterwards TC tries to re-sync the lines to find again matching text, but does it differently from how a human would see it...
Author of Total Commander
https://www.ghisler.com
Post Reply