Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2016-07-29 15:29:14 +0300
committerFatih Acet <acetfatih@gmail.com>2016-08-12 23:24:43 +0300
commit7af277f683cd5ee0d5e3ffbc1dd3ce1d61f17848 (patch)
treee442df62fad56f5d907306ca8513a24a319d854b /lib/gitlab/diff
parentd77216356a686029410c16d35775e42ef81a0e64 (diff)
Auto-highlight conflict when rich_text is called
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r--lib/gitlab/diff/line.rb11
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