Align columns in which-key with wide characters properly
authorThomas Voss <mail@thomasvoss.com>
Wed, 25 Sep 2024 00:17:49 +0000 (02:17 +0200)
committerEli Zaretskii <eliz@gnu.org>
Wed, 25 Sep 2024 11:55:25 +0000 (14:55 +0300)
In the case that a character takes up multple columns (such as
`…' when used as a truncation character), make sure that the
columns are still aligned properly.
* lisp/which-key.el (which-key--pad-column): Use `string-width'
instead of `length'.  (Bug#73463)

Copyright-paperwork-exempt: yes

lisp/which-key.el

index 91eb05c4dc7c0db270ea783a0e86899168a6cccc..fb0685cd3a92dbd3bc5f54a8e240845bfeb692cb 100644 (file)
@@ -2037,7 +2037,7 @@ that width."
           (mapcar (pcase-lambda (`(,key ,sep ,desc ,_doc))
                     (concat
                      (format col-format key sep desc)
-                     (make-string (- col-desc-width (length desc)) ?\s)))
+                     (make-string (- col-desc-width (string-width desc)) ?\s)))
                   col-keys))))
 
 (defun which-key--partition-list (n list)