sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 95c34f38b36980e3a7ed3ae045a4879beb2cf10a
parent d8776329d314e63fafc99096fe2418cb81ec6bb0
Author: William Morgan <wmorgan-sup@masanjin.net>
Date:   Sat, 30 May 2009 17:15:33 -0700

Merge branch 'master' into next

Diffstat:
M lib/sup/buffer.rb | 5 +++--
M lib/sup/modes/scroll-mode.rb | 8 +++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
@@ -110,8 +110,9 @@ class Buffer
     s ||= ""
     maxl = @width - x
     @w.mvaddstr y, x, s[0 ... maxl]
-    unless s.length >= maxl || opts[:no_fill]
-      @w.mvaddstr(y, x + s.length, " " * (maxl - s.length))
+    l = s.display_length
+    unless l >= maxl || opts[:no_fill]
+      @w.mvaddstr(y, x + l, " " * (maxl - l))
     end
   end
 
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