Edgewall Software

Ticket #7486 (new defect)

Opened 5 months ago

Last modified 3 months ago

wrong space in diff output

Reported by: moo Owned by:
Priority: normal Milestone: 0.11.3
Component: version control/changeset view Version: 0.11-stable
Severity: normal Keywords: diff space
Cc: phpxcache@…

Description

i'm not sure if this applies to other mimetype syntax highligher

See URL: http://linuxfire.com.cn/BadGirl/changeset/290

the new "num0_254" is EXPECTED to be align to num1_254 but it is ACTUALLY 1 char off and align to "("

actual code output:

                        <th>114</th><th> </th><td class="l"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <del>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </del> num0_254,</span> </td>

expected code output

                        <th>114</th><th> </th><td class="l"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <del>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </del>&nbsp;num0_254,</span> </td>

please note the difference is, "</del> " is changed to "</del>&nbsp;"

tech reason: although space following &nbsp; is recognized as space, e.g.: "&nbsp; " is same as "&nbsp;&nbsp;", but space following the "<tag>" is not. "</del> " should be escape as "</del>&nbsp;"

Attachments

Change History

Changed 5 months ago by ebray <hyugaricdeau@…>

I don't understand why you think there should be an &nbsp; after the </del> tag. The only spaces that ought to be displayed are the ones that were deleted. And FF3 anyways seems to be rendering the correct number of spaces. Not sure exactly why there's a space after the </del> tag, but it's harmless.

Changed 5 months ago by moo

"The only spaces that ought to be displayed are the ones that were deleted"

neither FF3 or IE is rendering the correct number of spaces here.

i'm not sure how the diff algo works. but i'm sure about the space after ">", it's never rendered

{{{
#!html
<span style="background:red;color:white"> a</span><br>
<span style="background:red;color:white">&nbsp;a</span>
}}}

rendered as:

a
 a

if you need the space after "</del>", escape it as "&nbsp;", if you think the space shouldn't be there, simply remove it instead of rely on the mystery browser bahavoir.

Changed 5 months ago by moo

btw, u can download the unidiff from http://linuxfire.com.cn/BadGirl/changeset/290?format=diff&new=290 and render it in your local trac

u can also highlight tab by "/<TAB>" (search for tab) in vim and u'll see the tab changes. i suppose the tab/space changes explains the reason why there is space after </del>

btw, not just space after ">" but also space at line begining like

{{{
#!html
<div style="font-family: mono, monospace">
- no space
 - one space<br>
&nbsp;- one nbsp<br>
&nbsp; - one nbsp and a space<br>
 &nbsp; - one space and a nbsp<br>
</div>
}}}

is rendered as

- no space - one space
 - one nbsp
  - one nbsp and a space
 - one space and a nbsp

you think they're same rendered, they're not

i forgot to add monospace to the "<span> a</span>" example, here we go:

{{{
#!html
<span style="background:red;color:white; font-family: mono, monospace"> a</span><br>
<span style="background:red;color:white; font-family: mono, monospace">&nbsp;a</span>
}}}

rendered as

a
 a

Changed 5 months ago by anonymous

oops, forgot a <br>

{{{
#!html
<div style="font-family: mono, monospace">
* no space<br>
 - one space<br>
* no space<br>
&nbsp;- one nbsp<br>
* no space<br>
&nbsp; - one nbsp and a space<br>
* no space<br>
 &nbsp;- one space and a nbsp<br>
* no space<br>
</div>
}}}

is rendered as

* no space
- one space
* no space
 - one nbsp
* no space
  - one nbsp and a space
* no space
 - one space and a nbsp
* no space

sorry for the spam/noisy

Changed 3 months ago by cboos

  • keywords diff added
  • milestone changed from 0.11.2 to 0.11.3

Add/Change #7486 (wrong space in diff output)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from (none). Next status will be 'new'
The owner will change from (none) to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.