Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] Overwrite line contents before drawing the new contents (instead of filling up the rest)
@ 2010-05-07 18:55 Michael Stapelberg
  2010-05-14  1:58 ` Rich Lane
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Stapelberg @ 2010-05-07 18:55 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]

Hi,

quote from the commit message:

  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"

The problem was that \t is one character but will be displayed as multiple
characters, so that the filling started too early and overwrote valid content
of the line (the "bar" is not visible).

Best regards,
Michael

[-- Attachment #2: 0001-Overwrite-line-contents-before-drawing-the-new-conte.patch --]
[-- Type: application/octet-stream, Size: 1220 bytes --]

From 4a9ddd658b6f4c6220358f1b9ce90c8c3527ea52 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Fri, 7 May 2010 20:48:11 +0200
Subject: [PATCH] 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"
---
 lib/sup/buffer.rb |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/sup/buffer.rb b/lib/sup/buffer.rb
index f32be67..9f9e929 100644
--- 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
-- 
1.7.0


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-14  1:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-07 18:55 [sup-devel] [PATCH] Overwrite line contents before drawing the new contents (instead of filling up the rest) Michael Stapelberg
2010-05-14  1:58 ` Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox