HTML Diff Report Height Bug?

General questions about using ExamDiff Pro, ideas for new features, bug reports, and usage tips.
Post Reply
radioboyjr
New Member
Posts: 3
Joined: Thu Oct 31, 2013 5:55 am

HTML Diff Report Height Bug?

Post by radioboyjr »

Hello!

I've been generating hundreds of javascript-enabled Diff Reports for work and I think I've happened upon a bug. It occurs when the height of the diff is taller than the window height. Say I have a file with 400 lines of code, and 4 diffs with length as follows:

Diff 1: 1 line
Diff 2: 5 lines
Diff 3: 100 lines
Diff 4: 2 lines

If I use the navigation buttons to jump to the next diff, I have no issues jumping between diffs 1 and 2, but when I jump to diff 3, the view returns to line 1 of my code! Looking at difftempl.html, line 191, I think the code should be : $('.file').scrollTop(block.position().top - tableMidpoint) rather than $('.file').scrollTop(midpoint - block.position().top), as var midpoint hasn't even been defined at that point.

Anyone else see this issue?
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: HTML Diff Report Height Bug?

Post by psguru »

Could you attach your diff report with this problem?
psguru
PrestoSoft
radioboyjr
New Member
Posts: 3
Joined: Thu Oct 31, 2013 5:55 am

Re: HTML Diff Report Height Bug?

Post by radioboyjr »

I can't post my exact diff report because of the confidential content but I pulled some random code off of the net to create a sample file.

What I did notice in the process is that the problem is not replicated in IE, but is an issue for Chrome or Firefox. This is probably because IE cannot center the code changes in the viewing window as the script intends, which in my opinion is a bug which prevents the other bug from occurring. We don't use IE so that is not an issue for us anyway.

With the attached report, you will see that when you get to diff 3, the window returns to line 1 and then continues to diff 4 as expected when you go to the next change. You never see diff 3 in the window using the prev/next change buttons!
Attachments
diff_doc_a_doc_b_Oct-31-2013 16-23.zip
(45.23 KiB) Downloaded 606 times
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: HTML Diff Report Height Bug?

Post by psguru »

Thanks. The fix will appear in the next build of 6.0. In the meantime, along the lines you proposed, the HTML template can be changed to have

$('.file').scrollTop(block.position().top - tableMidpoint + $('.file').height() / 2 - $lineHeight);
psguru
PrestoSoft
radioboyjr
New Member
Posts: 3
Joined: Thu Oct 31, 2013 5:55 am

Re: HTML Diff Report Height Bug?

Post by radioboyjr »

Thanks for confirming. It's good to know I'm not crazy.

I like your change because it puts the page length+ diff at the top of the viewing window instead of centering it like my suggestion, that really makes sense because you can see more of the change.

Your code, however, needs improvement. You have $('.file').scrollTop(block.position().top - tableMidpoint + $('.file').height() / 2 - $lineHeight), which is essentially (a - b + b - c) because tableMidpoint = $('.file').height() / 2. You might want to simplify this for your release. :D
User avatar
psguru
Site Admin
Posts: 2228
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: HTML Diff Report Height Bug?

Post by psguru »

Thanks, makes sense.
psguru
PrestoSoft
Post Reply