From 0dcad937f9b730464a979a4304392133f1031afa Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Tue, 16 Jan 2024 10:44:46 +0100 Subject: [PATCH] ; Align completion annotations with spaces for multi-column format Use actual spaces to align completion annotations instead of "specified space" display properties, since that allows 'completion--insert-strings' to correctly align multiple completion columns when 'completions-format' is not 'one-column'. * lisp/minibuffer.el (completion-styles-affixation) (completion-file-name-affixation): Align annotations with spaces instead of using '(space :align-to ...)' display properties. --- lisp/minibuffer.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 7c027629046..0f503523817 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -2828,8 +2828,9 @@ current order instead." "" (if-let ((desc (nth 3 (assoc (intern name) completion-styles-alist)))) - (concat (propertize " " 'display - `(space :align-to ,(+ max-name 4))) + (concat (make-string (- (+ max-name 4) + (string-width name)) + ?\s) (propertize ;; Only use the first line. (substring desc 0 (string-search "\n" desc)) @@ -3638,11 +3639,10 @@ same as `substitute-in-file-name'." (concat minibuffer-completion-base file)))) (list file "" (if-let ((ann (file-name-completion-annotation full))) - (propertize - (concat (propertize " " 'display - `(space :align-to ,(+ max-file 2))) - ann) - 'face 'completions-annotations) + (concat (make-string (- (+ max-file 2) + (string-width file)) + ?\s) + (propertize ann 'face 'completions-annotations)) "")))) files))) -- 2.39.2