Add support for line ending detection in our diff parser.
Line endings are now preserved during the diff parsing. When the diff is then rendered later on, we replace non-printable characters by their ordinal counterparts, so a user can easily grasp changes when a hunk comes with edits that might be invisible at first. The expected format for the diff test suite has changed from serialized PHP to var_export, which is easier readable, editable and understandable, while still keeping parsable as well. Support for old Macintosh line endings could not be added, mainly because modern SCMs do not support single \r in their unified diff output either and working around and parsing these "lines" would have been a major headache with not much outcome (given the fact that all Macs that have been sold since 2001 or 2002 have been BSD-based and as such used Unix line endings by default). This commit fixes issue 636.
This commit is contained in:
@@ -614,18 +614,56 @@ td.diff-r {
|
||||
background-color: #fdd;
|
||||
}
|
||||
|
||||
td.diff-a, td.diff-r, td.diff-c {
|
||||
td.diff {
|
||||
border-bottom: none;
|
||||
border-top: none;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
td.diff-a > span,
|
||||
td.diff-r > span,
|
||||
td.diff-c > span {
|
||||
td.diff > span {
|
||||
float: left;
|
||||
}
|
||||
|
||||
td.diff > span.non-printable {
|
||||
visibility: hidden;
|
||||
color: white;
|
||||
text-transform: uppercase;
|
||||
float: none;
|
||||
font-size: 5.5pt;
|
||||
font-family: Calibri, Helvetica, Arial, sans-serif;
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
word-wrap: break-word;
|
||||
padding: 1px 1px 0px 1px;
|
||||
margin-left: 1px;
|
||||
margin-right: 1px;
|
||||
-moz-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
cursor: default;
|
||||
vertical-align: 10%;
|
||||
}
|
||||
|
||||
td.diff:hover > span.non-printable {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
td.diff-a > span.non-printable {
|
||||
background: #0A0;
|
||||
}
|
||||
|
||||
td.diff-r > span.non-printable {
|
||||
background: #A00;
|
||||
}
|
||||
|
||||
td.diff-c > span.non-printable {
|
||||
background: black;
|
||||
}
|
||||
|
||||
/* override prettify css rule */
|
||||
td.diff > span.non-printable > * {
|
||||
color: white;
|
||||
}
|
||||
|
||||
table.diff tr.diff-next {
|
||||
background-color: #e4e8E0;
|
||||
vertical-align: top;
|
||||
|
Reference in New Issue
Block a user