class Diff::LCS::Hunk

def context_diff(last = false)

def context_diff(last = false)
  s = encode("***************\n")
  s << encode("*** #{context_range(:old, ',', last)} ****\n")
  r = context_range(:new, ',', last)
  if last
    old_missing_newline = missing_last_newline?(@data_old)
    new_missing_newline = missing_last_newline?(@data_new)
  end
  # Print out file 1 part for each block in context diff format if there
  # are any blocks that remove items
  lo, hi = @start_old, @end_old
  removes = @blocks.reject { |e| e.remove.empty? }
  unless removes.empty?
    outlist = @data_old[lo..hi].map { |e| String.new("#{encode('  ')}#{e.chomp}") }
    last_block = removes[-1]
    removes.each do |block|
      block.remove.each do |item|
        outlist[item.position - lo][0, 1] = encode(block.op) # - or !
      end
      if last && block == last_block && old_missing_newline
        outlist << encode('\\ No newline at end of file')
      end
    end
    s << outlist.join(encode("\n")) << encode("\n")
  end
  s << encode("--- #{r} ----\n")
  lo, hi = @start_new, @end_new
  inserts = @blocks.reject { |e| e.insert.empty? }
  unless inserts.empty?
    outlist = @data_new[lo..hi].map { |e| String.new("#{encode('  ')}#{e.chomp}") }
    last_block = inserts[-1]
    inserts.each do |block|
      block.insert.each do |item|
        outlist[item.position - lo][0, 1] = encode(block.op) # + or !
      end
      if last && block == last_block && new_missing_newline
        outlist << encode('\\ No newline at end of file')
      end
    end
    s << outlist.join(encode("\n"))
  end
  s
end