Edgewall Software
Modify

Opened 8 years ago

Last modified 8 months ago

#10813 new defect

diff view (tabular) whitespace off-by-one mistake

Reported by: theultramage <umage@…> Owned by:
Priority: normal Milestone: next-stable-1.4.x
Component: version control/changeset view Version: 1.0dev
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I have made a commit that looks like the following:

  • (a) a vs. (b) b

    a b  
    1212        return ( stricmp(cpname, "utf-8"   ) == 0 ) ? CP_UTF8
    1313             : ( stricmp(cpname, "euc-kr"  ) == 0 ) ? CP_EUCKR
    14                 :
     14             :

It was to fix a whitespace typo where my editor put in two tabs instead of a tab and five spaces. Now, when I view the revision in the changeset view using 'tabular' mode, the + part of the diff is missing one space and the : is no longer aligned with the line above.

I did some tests with the generated html code, and the cause is the following snippet: <span><ins>&nbsp; &nbsp; </ins> :</span> compare that to the html generated in this ticket view: <span><ins>&nbsp; &nbsp; &nbsp;</ins>:</span>

In the changeset view, trac generates the missing blank space outside of the <ins> segment, but that area is not pre-formatted and so the space is discarded by the browser. And even if it wasn't, it would still be colored wrong. What's also weird is the alternating chain of &nbsp; and spaces, instead of just &nbsp; packed together (is this filesize optimization?).

Note that the 'unified' mode does not suffer from this issue as it seems to be taking this off-by-one issue into account and compensating for it. PS: I believe this issue has existed for years.

Attachments (0)

Change History (4)

comment:1 by theultramage <umage@…>, 8 years ago

For reference, it looks like this in today's trunk (because of the incorrectly generated html):

  • (a) a vs. (b) b

    a b  
    1212        return ( stricmp(cpname, "utf-8"   ) == 0 ) ? CP_UTF8
    1313             : ( stricmp(cpname, "euc-kr"  ) == 0 ) ? CP_EUCKR
    14                 :
     14            :

comment:2 by Christian Boos, 8 years ago

Milestone: next-stable-1.0.x

comment:3 by Ryan J Ollos, 4 years ago

Milestone: next-stable-1.0.xnext-stable-1.2.x

Moved ticket assigned to next-stable-1.0.x since maintenance of 1.0.x is coming to a close. Please move the ticket back if it's critical to fix on 1.0.x.

comment:4 by Ryan J Ollos, 8 months ago

Milestone: next-stable-1.2.xnext-stable-1.4.x

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.