Append the string designed to be printed in the terminal to the specified buffer.
Parameters:
buf
: output buffer.entry
: entry to format.sorted_mismatches
: sorted list of indexes of the items to emphasize.term_normal
: terminal control code to re-apply the formatting that was
in force prior calling this method.term_emphasis
: terminal control code to apply to items listed in
sorted_mismatches
.
# Show an entry of a mismatch (without the margin).
#
# Append the string designed to be printed in the terminal to the
# specified buffer.
#
# Parameters:
#
# * `buf`: output buffer.
# * `entry`: entry to format.
# * `sorted_mismatches`: sorted list of indexes of the items to emphasize.
# * `term_normal`: terminal control code to re-apply the formatting that was
# in force prior calling this method.
# * `term_emphasis`: terminal control code to apply to items listed in
# `sorted_mismatches`.
private fun diff_append_mismatch_entry(buf: Buffer, entry: Array[String],
sorted_mismatches: Collection[Int], term_normal: String,
term_emphasis: String) do
var i = 0
var j = sorted_mismatches.iterator
var length = entry.length
while i < length do
while j.is_ok and j.item < i do
j.next
end
if j.is_ok and j.item == i then
buf.append(term_emphasis)
buf.append(entry[i])
buf.append(term_normal)
else
buf.append(entry[i])
end
i += 1
if i < length then
buf.append("; ")
end
end
end
lib/saxophonit/testing.nit:219,2--256,4