emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master baa9df7 30/67: Truncate candidates to window width in the


From: Oleh Krehel
Subject: [elpa] master baa9df7 30/67: Truncate candidates to window width in the minibuffer
Date: Sun, 22 Mar 2015 17:33:59 +0000

branch: master
commit baa9df7d008a4500a474ae5d42372a4cf0e5d825
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]