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

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

[elpa] master 1f64cb8 11/54: ivy: enlarge the minibuffer window if the c


From: Oleh Krehel
Subject: [elpa] master 1f64cb8 11/54: ivy: enlarge the minibuffer window if the candiate list doesn't fit
Date: Tue, 29 Sep 2015 14:09:50 +0000

branch: master
commit 1f64cb83928548aec944ae16b49d79077f1dfc5e
Author: Felix Lange <address@hidden>
Commit: Felix Lange <address@hidden>

    ivy: enlarge the minibuffer window if the candiate list doesn't fit
    
    Fixes #161
    Fixes #198
---
 ivy.el |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ivy.el b/ivy.el
index 37091f0..48f3e12 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1215,7 +1215,6 @@ Insert .* between each char."
   (set (make-local-variable 'minibuffer-default-add-function)
        (lambda ()
          (list ivy--default)))
-  (setq line-spacing 0)
   (setq-local max-mini-window-height ivy-height)
   (add-hook 'post-command-hook #'ivy--exhibit nil t)
   ;; show completions with empty input
@@ -1377,7 +1376,18 @@ Should be run via minibuffer `post-command-hook'."
       (let ((buffer-undo-list t))
         (save-excursion
           (forward-line 1)
-          (insert text))))))
+          (insert text))))
+    (when (display-graphic-p)
+      (ivy--resize-minibuffer-to-fit))))
+
+(defun ivy--resize-minibuffer-to-fit ()
+  "Resize the minibuffer window so it has enough space to display
+all of the text contained in the minibuffer."
+  (with-selected-window (minibuffer-window)
+    (let ((text-height (cdr (window-text-pixel-size)))
+          (body-height (window-body-height nil t)))
+      (when (> text-height body-height)
+        (window-resize nil (- text-height body-height) nil t t)))))
 
 (declare-function colir-blend-face-background "ext:colir")
 



reply via email to

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