diff options
author | Patrick Bajao <ebajao@gitlab.com> | 2019-09-02 06:19:32 +0300 |
---|---|---|
committer | Patrick Bajao <ebajao@gitlab.com> | 2019-09-02 06:44:45 +0300 |
commit | bf230da05d8a3a6feeeb80d81fa0370cc295478e (patch) | |
tree | caefbfda883d3360cb2aea07a5ea925447e39a5b /app/presenters/blobs | |
parent | 60adc14473911fd9bd33feef2fbfd62a9824a11c (diff) |
Support selective highlighting of lines
Instead of highlighting all lines when not all of them
are needed, only highlight from the beginning up to
the specified limit.
The `BlobPresenter#highlight` method has been updated
to support `to` param. This param will be used to limit
the content to be highlighted.
Diffstat (limited to 'app/presenters/blobs')
-rw-r--r-- | app/presenters/blobs/unfold_presenter.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/app/presenters/blobs/unfold_presenter.rb b/app/presenters/blobs/unfold_presenter.rb index a256dd05a4d..487c6fe0757 100644 --- a/app/presenters/blobs/unfold_presenter.rb +++ b/app/presenters/blobs/unfold_presenter.rb @@ -26,8 +26,6 @@ module Blobs # so we can accurately show the rest of the diff when unfolding. load_all_blob_data - @all_lines = blob.data.lines - handle_full_or_end! end @@ -46,7 +44,7 @@ module Blobs def lines strong_memoize(:lines) do - limit(highlight.lines).map(&:html_safe) + limit(highlight(to: to).lines).map(&:html_safe) end end @@ -76,7 +74,7 @@ module Blobs def all_lines_size strong_memoize(:all_lines_size) do - @all_lines.size + all_lines.size end end @@ -101,7 +99,7 @@ module Blobs def limited_blob_lines strong_memoize(:limited_blob_lines) do - limit(@all_lines) + limit(all_lines) end end |