]> code.delx.au - gnu-emacs-elpa/commitdiff
Set truncate-lines in the minibuffer
authorOleh Krehel <ohwoeowho@gmail.com>
Fri, 11 Sep 2015 09:42:18 +0000 (11:42 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Fri, 11 Sep 2015 13:46:04 +0000 (15:46 +0200)
* ivy.el (ivy--minibuffer-setup): Update.
(ivy-format-function-default): Check `truncate-lines'. Check if
`fringe-mode' is bound.

Fixes #223

ivy.el

diff --git a/ivy.el b/ivy.el
index 8e5405b6405b751c0ee755b527d6422925ac609f..30a454226c57bf11c98bd21be3ca61084f0040b3 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1229,6 +1229,8 @@ Insert .* between each char."
   (set (make-local-variable 'minibuffer-default-add-function)
        (lambda ()
          (list ivy--default)))
+  (when (display-graphic-p)
+    (setq truncate-lines t))
   (setq-local max-mini-window-height ivy-height)
   (add-hook 'post-command-hook #'ivy--exhibit nil t)
   ;; show completions with empty input
@@ -1502,14 +1504,16 @@ This string will be inserted into the minibuffer.")
 
 (defun ivy-format-function-default (cands)
   "Transform CANDS into a string for minibuffer."
-  (let ((ww (- (window-width)
-               (if (eq fringe-mode 0) 1 0))))
-    (mapconcat
-     (lambda (s)
-       (if (> (length s) ww)
-           (concat (substring s 0 (- ww 3)) "...")
-         s))
-     cands "\n")))
+  (if (bound-and-true-p truncate-lines)
+      (mapconcat #'identity cands "\n")
+    (let ((ww (- (window-width)
+                 (if (and (boundp fringe-mode) (eq fringe-mode 0)) 1 0))))
+      (mapconcat
+       (lambda (s)
+         (if (> (length s) ww)
+             (concat (substring s 0 (- ww 3)) "...")
+           s))
+       cands "\n"))))
 
 (defun ivy-format-function-arrow (cands)
   "Transform CANDS into a string for minibuffer."