The difference is made by EDP!

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

The difference is made by EDP!

Post by MSpagni »

I don't know what triggers the effect, but sometimes, if I select "ignore white space" and "word wrap", two lines who differs only in blank space are wrapped differently and then higlighted as different.
For example, try with the attached files.
Attachments
Wrap.zip
(457 Bytes) Downloaded 352 times
JeremyNicoll
Expert Member
Posts: 108
Joined: Sun May 02, 2010 12:00 pm
Location: Edinburgh

Re: The difference is made by EDP!

Post by JeremyNicoll »

One of your test files has spaces and tabs in it and the other just has spaces for indenting.

It seems to me that EDP could either remove the tabs and excess spaces, then wrap the lines OR expand the tabs to some number of spaces, wrap the lines, and then ignore multiple spaces. I'd guess that which non-blank words end up on which lines due to wrap might not be the same in that case.
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: The difference is made by EDP!

Post by psguru »

I'll have a look at this next week. Holidays...
psguru
PrestoSoft
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Re: The difference is made by EDP!

Post by MSpagni »

psguru wrote: Fri Nov 26, 2021 10:05 am I'll have a look at this next week. Holidays...
I think I can survive... :wink:
Happy holidays!

Good observation, Jeremy.
I assumed I already saved the files with "expand tabs" so I forgot to check.
Thanks.
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: The difference is made by EDP!

Post by psguru »

It's one of those situations, which seems easy to fix but... No matter how tabs are expanded, the result may not be what one expects. In this case you have, it appears, 8-size tabs but what EDP would use depends on its options. If the number is different, wrapping will still look bad. This is the nature of the Synchronized Wrap algorithm in EDP, which tries to align strings based on the first pass of comparison, before wrapping them and comparing again.

BTW, if you try the Simple Wrap option (that is, wrap and compare), the results will be much nicer in your scenario.
psguru
PrestoSoft
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Re: The difference is made by EDP!

Post by MSpagni »

psguru wrote: Thu Dec 09, 2021 11:01 am It's one of those situations, which seems easy to fix but...
Well, I didn't think a lot about it, but it looked far from simple to me.

Maybe with an option to collapse the blank space (i.e. every sequence of spaces and/or tabs is collapsed to a single space)?
I think I saw something like that in a program. But, of course, it does a mess with the code indentation...
psguru wrote: Thu Dec 09, 2021 11:01 am BTW, if you try the Simple Wrap option (that is, wrap and compare), the results will be much nicer in your scenario.
I completely overlooked this option. Probably I'll find it useful, soon or later.
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: The difference is made by EDP!

Post by psguru »

We are more than likely are just going to leave it as is.
psguru
PrestoSoft
JeremyNicoll
Expert Member
Posts: 108
Joined: Sun May 02, 2010 12:00 pm
Location: Edinburgh

Re: The difference is made by EDP!

Post by JeremyNicoll »

MSpagni wrote: Thu Dec 09, 2021 12:21 pm Maybe with an option to collapse the blank space (i.e. every sequence of spaces and/or tabs is collapsed to a single space)?
I think I saw something like that in a program. But, of course, it does a mess with the code indentation...
As a programmer, I find the idea of wrapping lines of code quite strange. Perhaps that's because most of my professional programming was done in languages whose origins were in 80-column cards, then 80-column terminal windows, though. Even now with much wider text editor windows I simply wouldn't try to write a line of code that's so long that it needs to wrap. That's not to say that I don't use line continuation, but I choose what goes on
the first/second/third line when I do that. I also wouldn't heavily indent code - I mean, if something needs more than four or five indents it suggests to me that a different program structure might be better for that part.

I would have thought that if you turned wrap off, then "ignore white space" would in essence collapse sequence of spaces.
MSpagni
Expert Member
Posts: 537
Joined: Mon Mar 30, 2009 12:53 am
Location: Italy

Re: The difference is made by EDP!

Post by MSpagni »

JeremyNicoll wrote: Sat Dec 11, 2021 3:02 am As a programmer, I find the idea of wrapping lines of code quite strange. Perhaps that's because most of my professional programming was done in languages whose origins were in 80-column cards, then 80-column terminal windows, though. Even now with much wider text editor windows I simply wouldn't try to write a line of code that's so long that it needs to wrap. That's not to say that I don't use line continuation, but I choose what goes on
the first/second/third line when I do that. I also wouldn't heavily indent code - I mean, if something needs more than four or five indents it suggests to me that a different program structure might be better for that part.
Exactly so do I. But not some others. :(
I hate when I have to scroll two or three screens to the right to look what's happening in that line of code.
It's too easy to overlook something.

After all, there must be a reason if, even after centuries, the newspapers still write in columns! :mrgreen:

Usually, in those cases I use AStyle (http://astyle.sourceforge.net/) as a plugin to "reconcile" the style as much as possible, then I use almost all the "ignores" of EDP.
But AStyle doesn't handle all the languages I need... let alone when it's a simple text flow, not code.

Well, I can easily do a "space collapser" plugin, after all.
Not a new idea: I altready though about it sometime ago, but then I let it fall in the "forgot bin".
Something to do during the long winter evenings, beside the fireplace... :wink:
Post Reply