bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24972: 26.0.50; Multibyte characters are misaligned in ibuffer


From: Liu Hui
Subject: bug#24972: 26.0.50; Multibyte characters are misaligned in ibuffer
Date: Tue, 22 Nov 2016 14:54:06 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0


在 2016年11月22日 13:12, Mark Oteiza 写道:
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))


It works very well. Thank you.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]