Commit 4be80f8a authored by Douwe Maan's avatar Douwe Maan

Fix highlighting in blame view.

parent a93f7099
......@@ -20,6 +20,7 @@ v 8.4.2 (unreleased)
improvement when checking if a repository was empty
- Add instrumentation for Gitlab::Git::Repository instance methods so we can
track them in Performance Monitoring.
- Fix highlighting in blame view.
v 8.4.2 (unreleased)
- Fix method undefined when using external commit status in builds
......
......@@ -18,7 +18,10 @@ class Projects::BlameController < Projects::ApplicationController
groups = []
current_group = nil
highlighted_lines = Gitlab::Highlight.highlight(@blob.name, @blob.data).lines
i = 0
blame.each do |commit, line|
line = highlighted_lines[i].html_safe
if prev_sha && prev_sha == commit.sha
current_group[:lines] << line
else
......@@ -27,6 +30,7 @@ class Projects::BlameController < Projects::ApplicationController
end
prev_sha = commit.sha
i += 1
end
groups << current_group if current_group.present?
......
......@@ -15,7 +15,6 @@
.file-content.blame.code.js-syntax-highlight
%table
- current_line = 1
- blame_highlighter = highlighter(@blob.name, @blob.data, nowrap: true)
- @blame.each do |blame_group|
%tr
%td.blame-commit
......@@ -38,8 +37,7 @@
\
- current_line += line_count
%td.lines
%pre{class: 'code highlight'}
%pre.code.highlight
%code
- blame_group[:lines].each do |line|
:preserve
#{blame_highlighter.highlight(line)}
#{line}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment