[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107634: Improve column width calcula
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107634: Improve column width calculation in tabulated-list.el. |
Date: |
Tue, 20 Mar 2012 23:44:45 +0800 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107634
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Tue 2012-03-20 23:44:45 +0800
message:
Improve column width calculation in tabulated-list.el.
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print-entry): Use
string-width and truncate-string-width to handle arbitrary
characters.
modified:
lisp/ChangeLog
lisp/emacs-lisp/tabulated-list.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-03-20 08:13:11 +0000
+++ b/lisp/ChangeLog 2012-03-20 15:44:45 +0000
@@ -1,3 +1,9 @@
+2012-03-20 Chong Yidong <address@hidden>
+
+ * emacs-lisp/tabulated-list.el (tabulated-list-print-entry): Use
+ string-width and truncate-string-width to handle arbitrary
+ characters.
+
2012-03-20 Tassilo Horn <address@hidden>
* textmodes/artist.el (artist-menu-map): Bind Rectangle menu item
=== modified file 'lisp/emacs-lisp/tabulated-list.el'
--- a/lisp/emacs-lisp/tabulated-list.el 2012-01-26 06:30:49 +0000
+++ b/lisp/emacs-lisp/tabulated-list.el 2012-03-20 15:44:45 +0000
@@ -278,11 +278,10 @@
(width (nth 1 format))
(label (if (stringp desc) desc (car desc)))
(help-echo (concat (car format) ": " label)))
- ;; Truncate labels if necessary.
- (and (> width 6)
- (> (length label) width)
- (setq label (concat (substring label 0 (- width 3))
- "...")))
+ ;; Truncate labels if necessary (except last column).
+ (and (< (1+ n) len)
+ (> (string-width label) width)
+ (setq label (truncate-string-to-width label width nil nil t)))
(setq label (bidi-string-mark-left-to-right label))
(if (stringp desc)
(insert (propertize label 'help-echo help-echo))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107634: Improve column width calculation in tabulated-list.el.,
Chong Yidong <=