Commit aa9e77b7 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch '26300-line-numbers-are-off-in-dynamically-loaded-diff-chunks' into 'master'

Resolve "Line numbers are off in dynamically loaded diff chunks"

Closes #26300

See merge request !8428
parents 575aea54 ece2e80b
...@@ -27,4 +27,4 @@ ...@@ -27,4 +27,4 @@
- if @form.unfold? && @form.bottom? && @form.to < @blob.loc - if @form.unfold? && @form.bottom? && @form.to < @blob.loc
%tr.line_holder{ id: @form.to, class: line_class } %tr.line_holder{ id: @form.to, class: line_class }
= diff_match_line @form.to, @form.to, text: @match_line, view: diff_view, bottom: true = diff_match_line @form.to - @form.offset, @form.to, text: @match_line, view: diff_view, bottom: true
/ Side-by-side diff view / Side-by-side diff view
.text-file.diff-wrap-lines.code.js-syntax-highlight{ data: diff_view_data } .text-file.diff-wrap-lines.code.js-syntax-highlight{ data: diff_view_data }
%table %table
- last_line = 0
- diff_file.parallel_diff_lines.each do |line| - diff_file.parallel_diff_lines.each do |line|
- left = line[:left] - left = line[:left]
- right = line[:right] - right = line[:right]
- last_line = right.new_pos if right
%tr.line_holder.parallel %tr.line_holder.parallel
- if left - if left
- case left.type - case left.type
...@@ -45,5 +43,7 @@ ...@@ -45,5 +43,7 @@
- discussion_left, discussion_right = parallel_diff_discussions(left, right, diff_file) - discussion_left, discussion_right = parallel_diff_discussions(left, right, diff_file)
- if discussion_left || discussion_right - if discussion_left || discussion_right
= render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right = render "discussions/parallel_diff_discussion", discussion_left: discussion_left, discussion_right: discussion_right
- if !diff_file.new_file && last_line > 0 - if !diff_file.new_file && diff_file.diff_lines.any?
= diff_match_line last_line, last_line, bottom: true, view: :parallel - last_line = diff_file.diff_lines.last
%tr.line_holder.parallel
= diff_match_line last_line.old_pos, last_line.new_pos, bottom: true, view: :parallel
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
%a.show-suppressed-diff.js-show-suppressed-diff Changes suppressed. Click to show. %a.show-suppressed-diff.js-show-suppressed-diff Changes suppressed. Click to show.
%table.text-file.code.js-syntax-highlight{ data: diff_view_data, class: too_big ? 'hide' : '' } %table.text-file.code.js-syntax-highlight{ data: diff_view_data, class: too_big ? 'hide' : '' }
- last_line = 0
- discussions = @grouped_diff_discussions unless @diff_notes_disabled - discussions = @grouped_diff_discussions unless @diff_notes_disabled
= render partial: "projects/diffs/line", = render partial: "projects/diffs/line",
collection: diff_file.highlighted_diff_lines, collection: diff_file.highlighted_diff_lines,
as: :line, as: :line,
locals: { diff_file: diff_file, discussions: discussions } locals: { diff_file: diff_file, discussions: discussions }
- last_line = diff_file.highlighted_diff_lines.last.new_pos - if !diff_file.new_file && diff_file.highlighted_diff_lines.any?
- if !diff_file.new_file && last_line > 0 - last_line = diff_file.highlighted_diff_lines.last
= diff_match_line last_line, last_line, bottom: true %tr.line_holder
= diff_match_line last_line.old_pos, last_line.new_pos, bottom: true
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