Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Tero Tilus <tero@tilus.net>
To: Anirudh Sanjeev <sup-bugs@masanjin.net>
Cc: sup-devel <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] [issue53] Error if the composed text has tabs in the first character
Date: Thu, 28 Jan 2010 00:15:19 +0200	[thread overview]
Message-ID: <1264630303-sup-9772@tilus.net> (raw)
In-Reply-To: <1264626708.47.0.495243760209.issue53@masanjin.net>

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

Anirudh Sanjeev, 2010-01-27 23:11:
> Steps to reproduce:
> 1. Compose message with a tab as a first character
> 2. View composed message in the compose-mode

Looks like tabs are counted as 1 (instead of 8) when calculating
string display width.  Dunno why this did not affect thread-view-mode
thought.  Patch attached.

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/

[-- Attachment #2: 0001-Count-tabs-as-8-chars-when-calculating-display-lengt.patch --]
[-- Type: application/octet-stream, Size: 620 bytes --]

From 2a0209b9dbd246e1791b08f0906f27327a1d5f39 Mon Sep 17 00:00:00 2001
From: Tero Tilus <tero@tilus.net>
Date: Thu, 28 Jan 2010 00:05:25 +0200
Subject: [PATCH] Count tabs as 8 chars when calculating display length

Signed-off-by: Tero Tilus <tero@tilus.net>
---
 lib/sup/util.rb |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index 861db7f..6757973 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -181,7 +181,7 @@ class String
       scan(/./u).size
     else
       size
-    end
+    end + 7 * (count "\t")
   end
 
   def camel_to_hyphy
-- 
1.5.6.5


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

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

      parent reply	other threads:[~2010-01-27 22:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27 21:11 Anirudh Sanjeev
2010-01-27 21:57 ` Mark Alexander
2010-01-27 22:29   ` Rich Lane
2010-01-27 22:15 ` Tero Tilus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1264630303-sup-9772@tilus.net \
    --to=tero@tilus.net \
    --cc=sup-bugs@masanjin.net \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox