sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 654c906e92378c9a9f9c4ade442282bf5f5ec45b
parent 0ecc69bd23c9247307900bef486ac3016bfd80e8
Author: Michael Stapelberg <michael@stapelberg.de>
Date:   Fri,  7 May 2010 20:48:11 +0200

Overwrite line contents before drawing the new contents (instead of filling up the rest)

This fixes display problems of mails with tab characters in it, like
"foo\n\tbar"

Diffstat:
M lib/sup/buffer.rb | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
@@ -130,15 +130,13 @@ class Buffer
     s ||= ""
     maxl = @width - x # maximum display width width
     stringl = maxl    # string "length"
+
+    # fill up the line with blanks to overwrite old screen contents
+    @w.mvaddstr y, x, " " * maxl unless opts[:no_fill]
+
     ## the next horribleness is thanks to ruby's lack of widechar support
     stringl += 1 while stringl < s.length && s[0 ... stringl].display_length < maxl
     @w.mvaddstr y, x, s[0 ... stringl]
-    unless opts[:no_fill]
-      l = s.display_length
-      unless l >= maxl
-        @w.mvaddstr(y, x + l, " " * (maxl - l))
-      end
-    end
   end
 
   def clear