Ignore blank lines

General questions about using ExamDiff Pro, ideas for new features, bug reports, and usage tips.
Post Reply
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Ignore blank lines

Post by MSpagni »

I have a problem regarding the blank (empty) lines.

Suppose you have 2 files like this.
file 1:

Code: Select all

aaaaaa  
(blank) 
cccccc  
file 2

Code: Select all

aaaaaa  
(blank) 
bbbbbb  
cccccc  
Comparing the two files with "ignore blank lines" produces results like this:

Code: Select all

file 1           file 2

aaaaaa           aaaaaa
(dummy)          (blank)
(dummy)          bbbbbb
(blank)          (dummy)
cccccc           cccccc
This is a minor annoyance if you just look at it but, if you copy a block from a side to the other, regularily you finish by having the blank line in the wrong position all the times and you must adjust it manually. Quite annoying.

Just in case, what I'd like to see would be:

Code: Select all

file 1           file 2

aaaaaa           aaaaaa
(blank)          (blank)
(dummy)          bbbbbb
cccccc           cccccc
I understand that I requested that the blank lines are ignored for the matter of comparison, but if they are shown (and copied) then a bit of consideration for them is due. :wink:
I have no idea on how to progrmmatically take care of this. I hope in you.
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: Ignore blank lines

Post by psguru »

Hmm, I get a different result:

Blank Lines.png
Blank Lines.png (9.19 KiB) Viewed 12847 times
psguru
PrestoSoft
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Re: Ignore blank lines

Post by MSpagni »

Possibly there is more than meets the eye.
Please, try with the attached files.
Attachments
a.h
(297 Bytes) Downloaded 537 times
b.h
(270 Bytes) Downloaded 535 times
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: Ignore blank lines

Post by psguru »

Yes, I see what you mean, and I'm sure I answered this question before. Here's what I get:

Blank Lines 1.png
Blank Lines 1.png (17.95 KiB) Viewed 12835 times
So yes, since blank lines are ignored, the diff algorithm doesn't care about them, and they are added to respective spots after comparison. The way it does it is like this: the blank line in the left file, line 13, is before line 14. On the right, the blank line 13 is before line 14. So they are placed in their respective places after comparison. While in this case it seems counter-intuitive, it's hard to generalize this algorithm (and we tried),

While it's a little annoying, you can either switch off ignores (or not ignore blank lines):

Blank Lines 2.png
Blank Lines 2.png (18.26 KiB) Viewed 12835 times
or use, for this rare occasion, manual line synchronization feature:

Blank Lines 3.png
Blank Lines 3.png (18.53 KiB) Viewed 12835 times
psguru
PrestoSoft
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Re: Ignore blank lines

Post by MSpagni »

I'm sure I answered this question before.
Now that you say it, I think you're right.
Sorry for having revived the topic, but in this period it has become especially annoying for me.

There must be some kind of algorithm.
Maybe a quick post-processing of the comparison results.
After all, the problem is only when comparing with "Ignore blank lines" and you have blank lines before and/or after a block of differences.
Only in this case, find how to maximize the matching of the common blank lines and let the other blank lines have their place like now.
Do you think it's feasible?
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: Ignore blank lines

Post by psguru »

Perhaps although I'm pretty sure we already looked into implementing this and, for whatever reason, did not. We'll have another look.
psguru
PrestoSoft
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Re: Ignore blank lines

Post by MSpagni »

Nothing is impossible for the man who doesn't have to do the work! :lol:
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Re: Ignore blank lines

Post by MSpagni »

Ehm...
Same problem with the comments when ignored... :roll:
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: Ignore blank lines

Post by psguru »

Yes, it's the same logic for all ignored lines.
psguru
PrestoSoft
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: Ignore blank lines

Post by psguru »

Good news! Your persistence paid off: it's a bug. It manifests itself in scenarios your posted but only for the second diff or any diff after that. The fix will appear in the next build.
psguru
PrestoSoft
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Re: Ignore blank lines

Post by MSpagni »

Wow! I'm very glad. :!:
I also feared you started to hate me... :wink:

Out of joke: now that you explained it, I understand why my first attempt to get an example failed but I still had problems.
Had I investigated a bit deeply I could have saved you a lot of work. Sorry.

Thank you very much, as always.
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: Ignore blank lines

Post by psguru »

No, no hate ;). And thanks for pursuing it.
psguru
PrestoSoft
Post Reply