1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +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:
vrana 2012-03-14 18:24:29 -07:00
parent 14c936dcfa
commit 0c20d7900e

View file

@ -484,14 +484,18 @@ final class DifferentialChangesetParser {
$old_corpus = array();
foreach ($this->old as $o) {
if ($o['type'] != '\\') {
$old_corpus[] = $o['text'];
}
}
$old_corpus_block = implode("\n", $old_corpus);
$new_corpus = array();
foreach ($this->new as $n) {
if ($n['type'] != '\\') {
$new_corpus[] = $n['text'];
}
}
$new_corpus_block = implode("\n", $new_corpus);
$old_future = $this->getHighlightFuture($old_corpus_block);
@ -1339,6 +1343,7 @@ final class DifferentialChangesetParser {
$o_attr = null;
if ($this->old[$ii]['type']) {
if ($this->old[$ii]['type'] == '\\') {
$o_text = $this->old[$ii]['text'];
$o_attr = ' class="comment"';
} elseif (empty($this->new[$ii])) {
$o_attr = ' class="old old-full"';
@ -1372,6 +1377,7 @@ final class DifferentialChangesetParser {
if ($this->new[$ii]['type']) {
if ($this->new[$ii]['type'] == '\\') {
$n_text = $this->old[$ii]['text'];
$n_attr = ' class="comment"';
} elseif (empty($this->old[$ii])) {
$n_attr = ' class="new new-full"';