Last modified: 2013-10-05 17:12:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27725, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25725 - Unwanted linebreaks in diffs when span.diffchange is present
Unwanted linebreaks in diffs when span.diffchange is present
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
wikidiff2 (Other open bugs)
unspecified
All All
: Normal minor (vote)
: ---
Assigned To: Tim Starling
http://en.wikipedia.org/w/index.php?t...
: need-integration-test
Depends on:
Blocks: 27720
  Show dependency treegraph
 
Reported: 2010-10-31 17:56 UTC by Erwin Dokter
Modified: 2013-10-05 17:12 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Screenshot showing fault (6.14 KB, image/gif)
2010-10-31 18:04 UTC, Erwin Dokter
Details

Description Erwin Dokter 2010-10-31 17:56:51 UTC
When adding some CSS to my userskin in order to show indents in diffs (see url for code), it revealed that DifferenceEngine.php (I think) is inserting unwnated linebreaks in the output HTML. While not 'illegal', it does thwart the intended effect. This only happens if the line contains a span.diffchange (the red text); other lines are fine. Below is the HTML output; note that line without a diffchange are one line, but the lines with a diffchange have a linebreak after <div> and before </div>, which breaks pre-wrap behaviour. Screenshot: http://en.wikipedia.org/wiki/File:Diff_with_unwanted_linebreaks.gif

<tr> 
  <td class="diff-marker"> </td> 
  <td class="diff-context"><div>}</div></td> 
  <td class="diff-marker"> </td> 
  <td class="diff-context"><div>}</div></td> 
</tr> 
<tr> 
  <td class="diff-marker"> </td> 
  <td class="diff-context"><div>/* Preserve white-space in diffs */</div></td> 
  <td class="diff-marker"> </td> 
  <td class="diff-context"><div>/* Preserve white-space in diffs */</div></td> 
</tr> 
<tr> 
  <td class="diff-marker">-</td> 
  <td class="diff-deletedline"><div> <!--unwanted linebreak-->
table.<span class="diffchange">div </span>td div {<!--unwanted linebreak-->
  </div></td> 
  <td class="diff-marker">+</td> 
  <td class="diff-addedline"><div> <!-- unwanted linebreak -->
table.<span class="diffchange">diff </span>td div {<!--unwanted linebreak-->
  </div></td> 
</tr> 
<tr> 
  <td class="diff-marker"> </td> 
  <td class="diff-context"><div>  white-space: pre-wrap;</div></td> 
  <td class="diff-marker"> </td> 
  <td class="diff-context"><div>  white-space: pre-wrap;</div></td> 
</tr> 
<tr> 
  <td class="diff-marker"> </td> 
  <td class="diff-context"><div>}</div></td> 
  <td class="diff-marker"> </td> 
  <td class="diff-context"><div>}</div></td> 
</tr>
Comment 1 Erwin Dokter 2010-10-31 18:04:31 UTC
Created attachment 7769 [details]
Screenshot showing fault
Comment 2 Bawolff (Brian Wolff) 2010-10-31 18:07:38 UTC
Theoretically, shouldn't the diff engine be using non-breaking spaces for any significant whitespace so using css white-space type hacks are unnecessary?
Comment 3 Erwin Dokter 2010-10-31 18:14:51 UTC
That would be an idea. On the other hand, if the original text doesn't contain non-breaking spaces, neither should the diff text, as it would introduce unwanted characters during copy/paste.
Comment 4 Derk-Jan Hartman 2010-11-01 00:15:13 UTC
It seems the linebreaks are used as word boundaries, and the the diff line routines are reused for word level comparison.

Fixed in r75769, by line-ending squashing the work comparison results.
Comment 5 Tim Starling 2011-01-20 07:14:08 UTC
The report is against Wikipedia. r75769 doesn't fix it there since it patches the PHP diff algorithm, not wikidiff2. You can tell that the quoted HTML comes from wikidiff2 because of the pretty-printing. Reopening.
Comment 6 Tim Starling 2011-01-20 09:54:47 UTC
It turns out there was no problem with the PHP version. Reverted r75769 and fixed the actual problem in r80621. Still needs packaging and deployment.
Comment 7 Mark A. Hershberger 2011-10-15 22:03:41 UTC
tagging bugs for Marcus to look at

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links