Compare different sections of the same file

Post your new features ideas and suggestions here.
adiroot
Posts: 4
Joined: Mon Jan 11, 2010 3:07 am

Compare different sections of the same file

Postby adiroot » Mon Jan 11, 2010 3:18 am

I would appreciate being able to compare a section of a file to another section of the same file.

I often write routines that look near identical to each other except for a few differences. The routines are in the same file and I need to compare them.

Currently, what I have to do is create a temporary file, copy one of the sections to it, then compare that file with the original.

E.g. File has these two routines:

CTxInstruct::CTxInstruct(const CTxInstruct& other)
{
memcpy((char*)this, (char *)&other, sizeof(CTxInstruct));
}

const CTxInstruct& CTxInstruct::operator=(const CTxInstruct& other)
{
memcpy((char*)this, (char *)&other, sizeof(CTxInstruct));
return *this;
}

I would be great if I could see the comparison of those two routines just as if each were in its own file.
Thanks!

grigsoft
Site Admin
Posts: 1671
Joined: Tue Sep 23, 2003 7:37 pm

Re: Compare different sections of the same file

Postby grigsoft » Tue Jan 12, 2010 6:21 pm

You can do that now, in fact. Select same file twice, and then put Manual Anchor (CTRL+M) on both sides for section you need. Recompare files and you will get what you probably need.

adiroot
Posts: 4
Joined: Mon Jan 11, 2010 3:07 am

Re: Compare different sections of the same file

Postby adiroot » Wed Jan 13, 2010 3:44 am

I tried the Manual Anchor but could not get it to work.
I compared a file to itself and set one anchor in each of the compared 'files'.

However, that does nothing except show markers where I put the anchors. Clicking on show anchor does not do a compare.
Attachments
CompareItManMatch.jpg
CompareItManMatch.jpg (102.81 KiB) Viewed 8206 times

grigsoft
Site Admin
Posts: 1671
Joined: Tue Sep 23, 2003 7:37 pm

Re: Compare different sections of the same file

Postby grigsoft » Wed Jan 13, 2010 7:55 pm

Try to rescan (F5) files

adiroot
Posts: 4
Joined: Mon Jan 11, 2010 3:07 am

Re: Compare different sections of the same file

Postby adiroot » Thu Jan 14, 2010 5:57 am

It does not work nearly as well. Most of the great features of CompareIt! are missing when done with anchors. See screenshots for comparing the same content when using the same file vs using different files.
Attachments
DiffFiles.jpg
DiffFiles.jpg (75.68 KiB) Viewed 8193 times
SameFile.jpg
SameFile.jpg (125.19 KiB) Viewed 8193 times

grigsoft
Site Admin
Posts: 1671
Joined: Tue Sep 23, 2003 7:37 pm

Re: Compare different sections of the same file

Postby grigsoft » Thu Jan 14, 2010 8:04 am

Yes, in your case same lines after anchors confuses program. At the moment the only option I can think of is some way to select block in file, mark it "for comparison", select block in other file, and say "Compare marked blocks". I guess this might be useful for some other cases too. This will work as manual anchor but for blocks, not for lines.


Return to “Compare It! - Suggestions”

Who is online

Users browsing this forum: No registered users and 1 guest