]> code.delx.au - gnu-emacs-elpa/commitdiff
ivy: fix ivy--resize-minibuffer-to-fit for small delta
authorFelix Lange <fjl@twurst.com>
Wed, 6 Jan 2016 22:28:24 +0000 (23:28 +0100)
committerFelix Lange <fjl@twurst.com>
Wed, 6 Jan 2016 23:03:31 +0000 (00:03 +0100)
Very small size increments can be necessary if the initial candidate
list is short (e.g. 3 items) and line-height is set to something other
than zero. In that case, only half of the last line is initially
visible. ivy--resize-minibuffer-to-fit recognizes this and tries to
enlarge the window up the the exact pixel height required, however
window-resize doesn't do anything if the delta is below
frame-char-height.

ivy.el

diff --git a/ivy.el b/ivy.el
index 01126d92b43c5308394139b33f51ac01ca0b7f36..16b8d81120e0aa9b9a2acde789f0308c7e254550 100644 (file)
--- a/ivy.el
+++ b/ivy.el
@@ -1752,7 +1752,10 @@ Should be run via minibuffer `post-command-hook'."
         (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)))
+            ;; Note: the size increment needs to be at least frame-char-height,
+            ;; otherwise resizing won't do anything.
+            (let ((delta (max (- text-height body-height) (frame-char-height))))
+              (window-resize nil delta nil t t))))
       (let ((text-height (count-screen-lines))
             (body-height (window-body-height)))
         (when (> text-height body-height)