---
Hi all,

I found that emms-mode-line-playlist-current has a bug when dealing with
track descriptions containing characters with a > 1 width.

Consider this track description:

(let ((foo "Hiroyuki Sawano - 澤野弘之 - KILL la KILL ORIGINAL SOUND TRACK - 
Kiる厭KiLL"))
  (string-width foo) ;=>75
  (length foo)) ;=>69

It takes 75 columns to display due to the kanji. Yet when concatenating
the string for display, we use character count, not width count.

(seq-subseq track-desc 0 emms-mode-line-length-limit) ;limit=70 by default
;=> args-out-of-range as our string is only 69 characters long

 emms-mode-line.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/emms-mode-line.el b/emms-mode-line.el
index 7773f8f..a843a12 100644
--- a/emms-mode-line.el
+++ b/emms-mode-line.el
@@ -64,9 +64,7 @@
     (format emms-mode-line-format
            (if (< (string-width track-desc) emms-mode-line-length-limit)
                track-desc
-             (concat
-              (seq-subseq track-desc 0 emms-mode-line-length-limit)
-              "...")))))
+             (truncate-string-to-width track-desc emms-mode-line-length-limit 
0 nil t)))))
 
 
 (define-obsolete-variable-alias 'emms-mode-line-active-p
-- 
2.47.1


Reply via email to