Sha256: a3c080720f5e976e804817497583bc8a9bf43ce0698f7c76ea88c7f47af45477
Contents?: true
Size: 974 Bytes
Versions: 5
Compression:
Stored size: 974 Bytes
Contents
require_relative 'difference' require_relative '../ui/color' module GitCrecord module Diff class Line < Difference attr_reader :selected def initialize(line) @line = line @selected = true super() end def to_s @line end def x_offset 6 end def add? @line.start_with?('+') end def del? @line.start_with?('-') end def selectable? add? || del? end def selected=(value) @selected = selectable? ? value : selected end def expanded false end def generate_diff return " #{@line[1..-1]}" if !selected && del? return @line if selected nil end def style(is_highlighted) return UI::Color.hl if is_highlighted return UI::Color.green if add? return UI::Color.red if del? UI::Color.normal end end end end
Version data entries
5 entries across 5 versions & 1 rubygems