commit e3df7b775de899f9f49ef324249fab9e2859359f
parent 71bbe4d3b74620adf8014f9ddc4698372c992f0b
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Sat, 30 May 2009 17:11:01 -0700
minor display optimization
Don't blank to the right unless this is the last thing we're drawing
in the line.
Not sure how much of a speedup this will give, if any, but hey, precious
milliseconds.
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/sup/modes/scroll-mode.rb b/lib/sup/modes/scroll-mode.rb
@@ -219,8 +219,9 @@ protected
def draw_line_from_array ln, a, opts
xpos = 0
- a.each do |color, text|
+ a.each_with_index do |(color, text), i|
raise "nil text for color '#{color}'" if text.nil? # good for debugging
+ no_fill = i != a.size - 1
if xpos + text.display_length < @leftcol
buffer.write ln - @topline, 0, "", :color => color,
@@ -230,11 +231,12 @@ protected
## partial
buffer.write ln - @topline, 0, text[(@leftcol - xpos) .. -1],
:color => color,
- :highlight => opts[:highlight]
+ :highlight => opts[:highlight], :no_fill => no_fill
xpos += text.display_length
else
buffer.write ln - @topline, xpos - @leftcol, text,
- :color => color, :highlight => opts[:highlight]
+ :color => color, :highlight => opts[:highlight],
+ :no_fill => no_fill
xpos += text.display_length
end
end