Fix display of R2L buffer names in Buffer-menu.
lisp/buff-menu.el (Buffer-menu-buffer+size): Accept an additional argument LRM; if non-nil, append an invisible LRM character to the buffer name. (list-buffers-noselect): Call Buffer-menu-buffer+size with the last argument non-nil, when formatting buffer names.
This commit is contained in:
parent
acb2881852
commit
cce4b0a79a
2 changed files with 21 additions and 4 deletions
|
|
@ -1,3 +1,11 @@
|
|||
2011-06-19 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* buff-menu.el (Buffer-menu-buffer+size): Accept an additional
|
||||
argument LRM; if non-nil, append an invisible LRM character to the
|
||||
buffer name.
|
||||
(list-buffers-noselect): Call Buffer-menu-buffer+size with the
|
||||
last argument non-nil, when formatting buffer names.
|
||||
|
||||
2011-06-18 Eli Zaretskii <eliz@gnu.org>
|
||||
|
||||
* buff-menu.el (Buffer-menu-mode, list-buffers-noselect): Force
|
||||
|
|
|
|||
|
|
@ -666,7 +666,7 @@ For more information, see the function `buffer-menu'."
|
|||
":" ;; (if (char-displayable-p ?…) "…" ":")
|
||||
)
|
||||
|
||||
(defun Buffer-menu-buffer+size (name size &optional name-props size-props)
|
||||
(defun Buffer-menu-buffer+size (name size &optional name-props size-props lrm)
|
||||
(if (> (+ (string-width name) (string-width size) 2)
|
||||
Buffer-menu-buffer+size-width)
|
||||
(setq name
|
||||
|
|
@ -681,9 +681,17 @@ For more information, see the function `buffer-menu'."
|
|||
(string-width tail)
|
||||
2))
|
||||
Buffer-menu-short-ellipsis
|
||||
tail)))
|
||||
tail
|
||||
;; Append an invisible LRM character to the
|
||||
;; buffer's name to avoid ugly display with the
|
||||
;; buffer size to the left of the name, when the
|
||||
;; name begins with R2L character.
|
||||
(if lrm (propertize (string ?\x200e) 'invisible t) ""))))
|
||||
;; Don't put properties on (buffer-name).
|
||||
(setq name (copy-sequence name)))
|
||||
(setq name (concat (copy-sequence name)
|
||||
(if lrm
|
||||
(propertize (string ?\x200e) 'invisible t)
|
||||
""))))
|
||||
(add-text-properties 0 (length name) name-props name)
|
||||
(add-text-properties 0 (length size) size-props size)
|
||||
(let ((name+space-width (- Buffer-menu-buffer+size-width
|
||||
|
|
@ -913,7 +921,8 @@ For more information, see the function `buffer-menu'."
|
|||
(max (length size) 3)
|
||||
2))
|
||||
name
|
||||
"mouse-2: select this buffer"))))
|
||||
"mouse-2: select this buffer"))
|
||||
nil t))
|
||||
" "
|
||||
(if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width)
|
||||
(truncate-string-to-width (nth 4 buffer)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue