diff view (tabular) whitespace off-by-one mistake
|Reported by:||Owned by:|
|Component:||version control/changeset view||Version:||1.0dev|
I have made a commit that looks like the following:
a b 12 12 return ( stricmp(cpname, "utf-8" ) == 0 ) ? CP_UTF8 13 13 : ( 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> </ins> :</span>
compare that to the html generated in this ticket view:
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 and spaces, instead of just 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.