sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit e47f06e891a073dbe7b8e66932923eb88bc5c3bd
parent 48c6e1ad9c0ba3073c4bd62c43656beb78f5901c
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sun, 31 May 2009 08:57:56 -0700

minor display_length optimization

Diffstat:
M lib/sup/modes/scroll-mode.rb | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/sup/modes/scroll-mode.rb b/lib/sup/modes/scroll-mode.rb
@@ -221,24 +221,23 @@ protected
     xpos = 0
     a.each_with_index do |(color, text), i|
       raise "nil text for color '#{color}'" if text.nil? # good for debugging
+      l = text.display_length
       no_fill = i != a.size - 1
       
-      if xpos + text.display_length < @leftcol
+      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], :no_fill => no_fill
-        xpos += text.display_length
       else
         buffer.write ln - @topline, xpos - @leftcol, text,
                      :color => color, :highlight => opts[:highlight],
                      :no_fill => no_fill
-        xpos += text.display_length
       end
+      xpos += l
     end
   end