branch: externals/vertico commit 27070bba78d5f736944ac5fc0ccd071dbe90e074 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
truncate long candidate strings --- minicomp.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/minicomp.el b/minicomp.el index b1da4f4..cda90ce 100644 --- a/minicomp.el +++ b/minicomp.el @@ -287,7 +287,8 @@ minibuffer-completion-predicate ""))) metadata candidates))) - (title nil) + (max-width (- (* 2 (window-width)) 5)) + (title) (formatted (propertize " " 'cursor t)) (group (completion-metadata-get metadata 'x-group-function))) (dolist (ann-cand ann-candidates formatted) @@ -309,8 +310,9 @@ (replace-regexp-in-string "\n+" "⤶") (string-trim) (minicomp--replace-prop 'display (lambda (x) (if (stringp x) x ""))) - (minicomp--replace-prop 'invisible (lambda (_) "")))) - (setq cand (concat prefix cand + (minicomp--replace-prop 'invisible (lambda (_) ""))) + cand (truncate-string-to-width cand max-width 0 nil "…") + cand (concat prefix cand (if (text-property-not-all 0 (length suffix) 'face nil suffix) suffix (propertize suffix 'face 'completions-annotations))))