diff options
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r-- | lib/gitlab/diff/line.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gitlab/diff/line.rb b/lib/gitlab/diff/line.rb index 5196051f90d..38400b48b5c 100644 --- a/lib/gitlab/diff/line.rb +++ b/lib/gitlab/diff/line.rb @@ -2,12 +2,13 @@ module Gitlab module Diff class Line attr_reader :type, :index, :old_pos, :new_pos + attr_writer :rich_text attr_accessor :text - attr_accessor :rich_text - def initialize(text, type, index, old_pos, new_pos) + def initialize(text, type, index, old_pos, new_pos, parent: nil) @text, @type, @index = text, type, index @old_pos, @new_pos = old_pos, new_pos + @parent = parent end def self.init_from_hash(hash) @@ -44,6 +45,12 @@ module Gitlab type == 'old' end + def rich_text + @parent.highlight_lines! if @parent && !@rich_text + + @rich_text + end + def meta? type == 'match' || type == 'nonewline' end |