all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: don@donarmstrong.com (Emacs bug Tracking System)
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Subject: bug#1369: marked as done (string-width problem in buff-menu.el)
Date: Thu, 20 Nov 2008 07:30:03 -0800	[thread overview]
Message-ID: <handler.1369.D1369.122719455919154.ackdone@emacsbugs.donarmstrong.com> (raw)
In-Reply-To: BAY121-DAV1198FA4A1B87BCA43F114BE2120@phx.gbl

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


Your message dated Thu, 20 Nov 2008 10:22:35 -0500
with message-id <jwviqqipgm1.fsf-monnier+emacsbugreports@gnu.org>
and subject line Re: bug#1369: string-width problem in buff-menu.el
has caused the Emacs bug report #1369,
regarding string-width problem in buff-menu.el
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
1369: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=1369
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 6067 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 823 bytes --]

hello.

I found a problem in buff-menu.el.
(I use GNU Emacs 22.3.1 (i386-msvc-nt5.0.2195).)

`list-buffers' function can't deal with buffer name in multilingual environment.
it can't truncate buffer name properly.

example:
========================================================================
CRM Buffer                Size  Mode              File
.%  あいうえおかきくけこさしすせそ        271  Dired by name ~/temp/あいうえおかきくけこさしすせそ/
 %  あいう                    247  Dired by name  ~/temp/あいう/
 %  *GNU Emacs*            669  Fundamental
    *scratch*              191  Lisp Interaction
  * *Messages*             691  Fundamental
========================================================================

i made a patch for this problem. please check it. if ok, please apply.

[-- Attachment #2.1.2: buff-menu.el.diff --]
[-- Type: application/octet-stream, Size: 2182 bytes --]

--- buff-menu.el.original	2008-01-07 11:45:02.000000000 +0900
+++ buff-menu.el	2008-11-19 00:23:38.786576000 +0900
@@ -587,21 +587,24 @@
   (display-buffer (list-buffers-noselect files-only)))
 
 (defun Buffer-menu-buffer+size (name size &optional name-props size-props)
-  (if (> (+ (length name) (length size) 2) Buffer-menu-buffer+size-width)
+  (if (> (+ (string-width name) (string-width size) 2) Buffer-menu-buffer+size-width)
       (setq name
 	    (if (string-match "<[0-9]+>$" name)
-		(concat (substring name 0
-				   (- Buffer-menu-buffer+size-width
-				      (max (length size) 3)
-				      (match-end 0)
-				      (- (match-beginning 0))
-				      2))
+		(concat (truncate-string-to-width name
+						  (- Buffer-menu-buffer+size-width
+						     (max (string-width size) 3)
+						     (string-width (match-string 0))
+						     2)
+						  0
+						  ?\s)
 			":"		; narrow ellipsis
 			(match-string 0 name))
-	      (concat (substring name 0
-				 (- Buffer-menu-buffer+size-width
-				    (max (length size) 3)
-				    2))
+	      (concat (truncate-string-to-width name
+						(- Buffer-menu-buffer+size-width
+						   (max (string-width size) 3)
+						   2)
+						0
+						?\s)
 		      ":")))		; narrow ellipsis
     ;; Don't put properties on (buffer-name).
     (setq name (copy-sequence name)))
@@ -609,8 +612,8 @@
   (add-text-properties 0 (length size) size-props size)
   (concat name
 	  (make-string (- Buffer-menu-buffer+size-width
-			  (length name)
-			  (length size))
+			  (string-width name)
+			  (string-width size))
 		       ?\s)
 	  size))
 
@@ -825,8 +828,11 @@
 					   mouse-face highlight
 					   help-echo "mouse-2: select this buffer"))
 		"  "
-		(if (> (length (nth 4 buffer)) Buffer-menu-mode-width)
-		    (substring (nth 4 buffer) 0 Buffer-menu-mode-width)
+		(if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width)
+		    (truncate-string-to-width (nth 4 buffer)
+					      Buffer-menu-mode-width
+					      0
+					      ?\s)
 		  (nth 4 buffer)))
 	(when (nth 5 buffer)
 	  (indent-to (+ Buffer-menu-buffer-column Buffer-menu-buffer+size-width

[-- Attachment #3: Type: message/rfc822, Size: 1879 bytes --]

From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Toru TSUNEYOSHI <t_tuneyosi@hotmail.com>
Cc: 1369-done@emacsbugs.donarmstrong.com
Subject: Re: bug#1369: string-width problem in buff-menu.el
Date: Thu, 20 Nov 2008 10:22:35 -0500
Message-ID: <jwviqqipgm1.fsf-monnier+emacsbugreports@gnu.org>

> I found a problem in buff-menu.el.
> (I use GNU Emacs 22.3.1 (i386-msvc-nt5.0.2195).)

> `list-buffers' function can't deal with buffer name in multilingual
> environment.  it can't truncate buffer name properly.

> i made a patch for this problem. please check it. if ok, please apply.

Thank you, applied,


        Stefan


      reply	other threads:[~2008-11-20 15:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <jwviqqipgm1.fsf-monnier+emacsbugreports@gnu.org>
2008-11-18 15:48 ` bug#1369: string-width problem in buff-menu.el Toru TSUNEYOSHI
2008-11-20 15:30   ` Emacs bug Tracking System [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=handler.1369.D1369.122719455919154.ackdone@emacsbugs.donarmstrong.com \
    --to=don@donarmstrong.com \
    --cc=monnier@IRO.UMontreal.CA \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.