mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Highlight files with no newline at end of file
Summary: Text "No newline at end of file" was sent to highlighter causing error with most languages. Test Plan: Display diff containing file with no newline at end of file. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1903
This commit is contained in:
parent
14c936dcfa
commit
0c20d7900e
1 changed files with 8 additions and 2 deletions
|
@ -484,14 +484,18 @@ final class DifferentialChangesetParser {
|
||||||
|
|
||||||
$old_corpus = array();
|
$old_corpus = array();
|
||||||
foreach ($this->old as $o) {
|
foreach ($this->old as $o) {
|
||||||
|
if ($o['type'] != '\\') {
|
||||||
$old_corpus[] = $o['text'];
|
$old_corpus[] = $o['text'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$old_corpus_block = implode("\n", $old_corpus);
|
$old_corpus_block = implode("\n", $old_corpus);
|
||||||
|
|
||||||
$new_corpus = array();
|
$new_corpus = array();
|
||||||
foreach ($this->new as $n) {
|
foreach ($this->new as $n) {
|
||||||
|
if ($n['type'] != '\\') {
|
||||||
$new_corpus[] = $n['text'];
|
$new_corpus[] = $n['text'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$new_corpus_block = implode("\n", $new_corpus);
|
$new_corpus_block = implode("\n", $new_corpus);
|
||||||
|
|
||||||
$old_future = $this->getHighlightFuture($old_corpus_block);
|
$old_future = $this->getHighlightFuture($old_corpus_block);
|
||||||
|
@ -1339,6 +1343,7 @@ final class DifferentialChangesetParser {
|
||||||
$o_attr = null;
|
$o_attr = null;
|
||||||
if ($this->old[$ii]['type']) {
|
if ($this->old[$ii]['type']) {
|
||||||
if ($this->old[$ii]['type'] == '\\') {
|
if ($this->old[$ii]['type'] == '\\') {
|
||||||
|
$o_text = $this->old[$ii]['text'];
|
||||||
$o_attr = ' class="comment"';
|
$o_attr = ' class="comment"';
|
||||||
} elseif (empty($this->new[$ii])) {
|
} elseif (empty($this->new[$ii])) {
|
||||||
$o_attr = ' class="old old-full"';
|
$o_attr = ' class="old old-full"';
|
||||||
|
@ -1372,6 +1377,7 @@ final class DifferentialChangesetParser {
|
||||||
|
|
||||||
if ($this->new[$ii]['type']) {
|
if ($this->new[$ii]['type']) {
|
||||||
if ($this->new[$ii]['type'] == '\\') {
|
if ($this->new[$ii]['type'] == '\\') {
|
||||||
|
$n_text = $this->old[$ii]['text'];
|
||||||
$n_attr = ' class="comment"';
|
$n_attr = ' class="comment"';
|
||||||
} elseif (empty($this->old[$ii])) {
|
} elseif (empty($this->old[$ii])) {
|
||||||
$n_attr = ' class="new new-full"';
|
$n_attr = ' class="new new-full"';
|
||||||
|
|
Loading…
Reference in a new issue