branch: master commit baa9df7d008a4500a474ae5d42372a4cf0e5d825 Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
Truncate candidates to window width in the minibuffer * ivy.el (ivy-completions): Update. --- ivy.el | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/ivy.el b/ivy.el index 47f3568..8a6432d 100644 --- a/ivy.el +++ b/ivy.el @@ -274,6 +274,7 @@ CANDIDATES is a list of strings." (lambda (x) (string-match re x)) candidates)))) (tail (nthcdr ivy--index ivy--old-cands)) + (ww (window-width)) idx) (setq ivy--length (length cands)) (when (and tail ivy--old-cands) @@ -301,7 +302,12 @@ CANDIDATES is a list of strings." (nth index cands))) (setf (nth index cands) (ivy--add-face ivy--current 'ivy-current-match)) - (concat "\n" (mapconcat #'identity cands "\n")))))) + (concat "\n" (mapconcat + (lambda (s) + (if (> (length s) ww) + (concat (substring s 0 (- ww 3)) "...") + s)) + cands "\n")))))) (provide 'ivy)