all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark Oteiza <mvoteiza@udel.edu>
To: Liu Hui <liuhui1610@gmail.com>
Cc: 24972@debbugs.gnu.org
Subject: bug#24972: 26.0.50; Multibyte characters are misaligned in ibuffer
Date: Tue, 22 Nov 2016 00:12:16 -0500	[thread overview]
Message-ID: <20161122051216.GA14073@holos.localdomain> (raw)
In-Reply-To: <1dbeb208-b7b5-e445-1946-c71aec1660da@gmail.com>

On 22/11/16 at 11:51am, Liu Hui wrote:
> Thank you, but the trailing "..." is missing for long buffer names, no
> matter whether they contain multibyte characters. For example,
> "01234567890123456789" becomes "012345678901234567". The normal result
> should be "012345678901234...".

Would you try the following?

diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index faadb67..c550b7d 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1559,16 +1559,17 @@ ibuffer-compile-make-eliding-form
 		  `(concat ,ellipsis
 			   (substring ,strvar
 				      (string-width ibuffer-eliding-string)))
-		`(truncate-string-to-width
-		  ,strvar strlen nil nil
-		  ,ellipsis))
+		`(concat
+		  (truncate-string-to-width
+                   ,strvar (- strlen (string-width ,ellipsis)) nil ?.)
+                  ,ellipsis))
 	   ,strvar)
       strvar)))
 
 (defun ibuffer-compile-make-substring-form (strvar maxvar from-end-p)
   (if from-end-p
-      `(truncate-string-to-width str (string-width str) (- strlen ,maxvar))
-    `(truncate-string-to-width ,strvar ,maxvar)))
+      `(truncate-string-to-width str (string-width str) (- strlen ,maxvar) nil ?\s)
+    `(truncate-string-to-width ,strvar ,maxvar nil ?\s)))
 
 (defun ibuffer-compile-make-format-form (strvar widthform alignment)
   (let* ((left `(make-string tmp2 ?\s))





  reply	other threads:[~2016-11-22  5:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-20 12:32 bug#24972: 26.0.50; Multibyte characters are misaligned in ibuffer Liu Hui
2016-11-20 18:58 ` Mark Oteiza
2016-11-21  6:00   ` Liu Hui
2016-11-21  9:35     ` Mark Oteiza
2016-11-22  3:51       ` Liu Hui
2016-11-22  5:12         ` Mark Oteiza [this message]
2016-11-22  6:54           ` Liu Hui
2016-11-22  7:49             ` Mark Oteiza

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=20161122051216.GA14073@holos.localdomain \
    --to=mvoteiza@udel.edu \
    --cc=24972@debbugs.gnu.org \
    --cc=liuhui1610@gmail.com \
    /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.