]> git.cworth.org Git - sup/commitdiff
minor display optimization
authorWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 31 May 2009 00:11:01 +0000 (17:11 -0700)
committerWilliam Morgan <wmorgan-sup@masanjin.net>
Sun, 31 May 2009 00:11:01 +0000 (17:11 -0700)
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.

lib/sup/modes/scroll-mode.rb

index 05fe201c224d8cd9d423c1b704cc5f95a790b8c7..7b21e5755a6ab9bfa1a5f087f030a6f60a993576 100644 (file)
@@ -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