Unexpected behavior compare content and text files with tabs

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

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Holyhead
Junior Member
Junior Member
Posts: 13
Joined: 2006-03-03, 20:06 UTC

Unexpected behavior compare content and text files with tabs

Post by *Holyhead »

I have observed a strange behavior in the compare content function of TC 7.02a:

Create two text files with the following content (the columns are separated by tabs):

Code: Select all

28	98	99.8	101.2	101.6	101.4	101.8	101.9
30	98.2	100.3	101.6	101.8	101.8	101.8	102.5
32	98.1	100.4	101.5	102	101.8	102.2	102.2
34	98.2	100.3	101.8	102.2	102	102.2	102.5
36	98.1	100.6	101.9	102.6	102.3	102.7	102.5
38	98	100.6	102	102.6	102.3	102.7	102.8

Code: Select all

28	98.2	100.2	101.2	101.6	101.4	101.8	101.9
30	98	100.2	101.6	101.8	101.8	101.8	102.5
32	98	100.3	101.5	102	101.8	102.2	102.2
34	98	100.4	101.8	102.2	102	102.2	102.5
36	98	100.5	101.9	102.6	102.3	102.7	102.5
38	98	100.6	102	102.6	102.3	102.7	102.8
Perform a text comparison:
  • * TC shows 1 difference. At first glance, I would say there are more differences (since I see more than 1 block of red [=different] characters).
    It looks like TC only counts blocks of lines with changes as differences.
    >> In my opinion, it would be nice if one would also see the character-count difference (e.g. number of red blocks).

    * In the first line, TC shows differences (digits in red) in columns three to five, albeit the numbers are the same.
    It looks like TC expands the tab characters to spaces and thus compares 1 character of file A to more than one character of file B (and vice versa). Hence, one gets the strange behavior that for some screen columns, the digits are the same, but the digit is red in file A and black in file B.
    >> It would be nice, if the TAB-to-spaces expansion could be switched off
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

i block, 1 diff.

Post by *Clo »

2Holyhead

:) Hello !
It looks like TC only counts blocks of lines with changes as differences.
• Yes, right
Help and Tuto wrote
¤ Next difference
–>Jumps to the next difference found.
A continuous block of different lines will be regarded as ONE difference.
• Maybe that'll be imporved in the future 7.5, with Unicode support too ?

:mrgreen: KR
Claude
Clo
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
Spawn51
Junior Member
Junior Member
Posts: 2
Joined: 2008-01-17, 16:15 UTC

Re: Unexpected behavior compare content and text files

Post by *Spawn51 »

Holyhead wrote:the columns are separated by tabs
It doesn't make any difference if they are tabs or not, I just tried your example with spaces instead. It doesn't even matter the number of spaces, regardless of the "CompareIgnoreRepSpace" setting.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

TC counts each block of unequal lines as ONE difference. The number of differences is the number of times you can click on "Next difference" to jump from one difference to the next.

How else would you count the differences? Number of different lines? Of different word insertions? Or even different characters?
Author of Total Commander
https://www.ghisler.com
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

Holyhead wrote:>> It would be nice, if the TAB-to-spaces expansion could be switched off
Nice idea. Although you would still see no difference, where the tab only expands to one space...

Alternative:
Color-marking white-space chars through background color was suggested before (e.g. here), this could maybe be an alternative -
if for each tab only one character is marked red (not the expanded additional spaces), this would help here, too.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

2ghisler(Author)
How else would you count the differences?
Perhaps an additional column "number of differences in this line" for each line.
This way you would know, when you have successfully found all differences...
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
Post Reply