]> git.cworth.org Git - sup/blobdiff - lib/sup/modes/scroll-mode.rb
Merge branch 'hook-local-vars' into next
[sup] / lib / sup / modes / scroll-mode.rb
index 05fe201c224d8cd9d423c1b704cc5f95a790b8c7..c13142599e9aed1aaad9bde0c1a029b2331fa72e 100644 (file)
@@ -3,7 +3,7 @@ module Redwood
 class ScrollMode < Mode
   ## we define topline and botline as the top and bottom lines of any
   ## content in the currentview.
-  
+
   ## we left leftcol and rightcol as the left and right columns of any
   ## content in the current view. but since we're operating in a
   ## line-centric fashion, rightcol is always leftcol + the buffer
@@ -219,24 +219,25 @@ 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
-      
-      if xpos + text.display_length < @leftcol
+      l = text.display_length
+      no_fill = i != a.size - 1
+
+      if xpos + l < @leftcol
         buffer.write ln - @topline, 0, "", :color => color,
                      :highlight => opts[:highlight]
-        xpos += text.display_length
       elsif xpos < @leftcol
         ## partial
         buffer.write ln - @topline, 0, text[(@leftcol - xpos) .. -1],
                      :color => color,
-                     :highlight => opts[:highlight]
-        xpos += text.display_length
+                     :highlight => opts[:highlight], :no_fill => no_fill
       else
         buffer.write ln - @topline, xpos - @leftcol, text,
-                     :color => color, :highlight => opts[:highlight]
-        xpos += text.display_length
+                     :color => color, :highlight => opts[:highlight],
+                     :no_fill => no_fill
       end
+      xpos += l
     end
   end