Skip to content

Commit e0190c4

Browse files
committed
Prevent which-key faces from over-extending during formatting
* lisp/which-key.el (which-key--pad-column): Instead of injecting the description using a left-aligned format-string (%-[n]s), we manually add the necessary padding so that the text properties don't extend beyond the description. This allows us to use a face with a background without it extending until the end of a column. See also 63a6fb2 for a similar issue with Quick Help.
1 parent e087178 commit e0190c4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lisp/which-key.el

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,10 +2005,12 @@ that width."
20052005
col-keys 2
20062006
which-key-min-column-description-width)))
20072007
(col-width (+ col-key-width col-sep-width col-desc-width))
2008-
(col-format (concat "%" (int-to-string col-key-width)
2009-
"s%s%-" (int-to-string col-desc-width) "s")))
2008+
(col-format (concat "%" (int-to-string col-key-width) "s%s%s")))
20102009
(cons col-width
2011-
(mapcar (lambda (k) (apply #'format col-format k))
2010+
(mapcar (pcase-lambda (`(,key ,sep ,desc ,_doc))
2011+
(concat
2012+
(format col-format key sep desc)
2013+
(make-string (- col-desc-width (length desc)) ?\s)))
20122014
col-keys))))
20132015

20142016
(defun which-key--partition-list (n list)

0 commit comments

Comments
 (0)