Fix padding when using which-key-setup-side-window-right
authorRobert Pluim <rpluim@gmail.com>
Sun, 2 Feb 2025 12:33:37 +0000 (13:33 +0100)
committerRobert Pluim <rpluim@gmail.com>
Mon, 3 Feb 2025 08:41:01 +0000 (09:41 +0100)
* lisp/which-key.el (which-key--pad-column): Insert zero padding
spaces when the description string is longer than the column
width.  (Bug#75765)

lisp/which-key.el

index d33e8b1a3bb84064672d365729d3b4a5b263d11d..6ae8dcbb1f0a26fb69953ca76abbc53d0d27b223 100644 (file)
@@ -2038,7 +2038,7 @@ that width."
           (mapcar (pcase-lambda (`(,key ,sep ,desc ,_doc))
                     (concat
                      (format col-format key sep desc)
-                     (make-string (- col-desc-width (string-width desc)) ?\s)))
+                     (make-string (max (- col-desc-width (string-width desc)) 0) ?\s)))
                   col-keys))))
 
 (defun which-key--partition-list (n list)