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.
This commit is contained in:
parent
025de85b07
commit
f0bcceb995
2 changed files with 10 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
|||
2012-03-20 Chong Yidong <cyd@gnu.org>
|
||||
|
||||
* 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 <tassilo@member.fsf.org>
|
||||
|
||||
* textmodes/artist.el (artist-menu-map): Bind Rectangle menu item
|
||||
|
|
|
@ -278,11 +278,10 @@ of column descriptors."
|
|||
(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))
|
||||
|
|
Loading…
Add table
Reference in a new issue