Use less memory while counting lines

This commit is contained in:
Jacob Vosmaer 2016-01-28 15:02:44 +01:00
parent 53ddb8f2cc
commit 9109619ee6

View file

@ -1,7 +1,7 @@
.file-content.code.js-syntax-highlight{ class: user_color_scheme } .file-content.code.js-syntax-highlight{ class: user_color_scheme }
.line-numbers .line-numbers
- if blob.data.present? - if blob.data.present?
- blob.data.lines.each_index do |index| - blob.data.each_line.each_with_index do |_, index|
- offset = defined?(first_line_number) ? first_line_number : 1 - offset = defined?(first_line_number) ? first_line_number : 1
- i = index + offset - i = index + offset
-# We're not using `link_to` because it is too slow once we get to thousands of lines. -# We're not using `link_to` because it is too slow once we get to thousands of lines.