summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff/highlight.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-01-20 19:20:13 +0100
committerDouwe Maan <douwe@selenight.nl>2016-01-20 19:20:13 +0100
commit0e992a3b4e710f8486a37bfa73ad6981365fceb2 (patch)
tree210146bede4529ed861a77cd36b7b9646b9af65c /lib/gitlab/diff/highlight.rb
parent577f2fb47a7ef57415b78b49d5c746d4e99f6a98 (diff)
downloadgitlab-ce-0e992a3b4e710f8486a37bfa73ad6981365fceb2.tar.gz
Properly highlight lines around '\ No newline at end of file'
Diffstat (limited to 'lib/gitlab/diff/highlight.rb')
-rw-r--r--lib/gitlab/diff/highlight.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/diff/highlight.rb b/lib/gitlab/diff/highlight.rb
index fe084a7399a..179f8164c84 100644
--- a/lib/gitlab/diff/highlight.rb
+++ b/lib/gitlab/diff/highlight.rb
@@ -14,7 +14,7 @@ module Gitlab
def highlight
@diff_lines.each_with_index do |diff_line, i|
# ignore highlighting for "match" lines
- next if diff_line.type == 'match'
+ next if diff_line.type == 'match' || diff_line.type == 'nonewline'
rich_line = highlight_line(diff_line, i)
@@ -33,7 +33,7 @@ module Gitlab
def highlight_line(diff_line, index)
return html_escape(diff_line.text) unless diff_file.diff_refs
- line_prefix = diff_line.text.match(/\A([+-])/) ? $1 : ' '
+ line_prefix = diff_line.text.match(/\A(.)/) ? $1 : ' '
case diff_line.type
when 'new', nil