branch: master
commit 09cb5c9625d5d9f0d7195ed399302d4f224ba086
Author: Felix Lange <f...@twurst.com>
Commit: Felix Lange <f...@twurst.com>

    ivy: fix ivy--resize-minibuffer-to-fit for small delta
    
    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 |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ivy.el b/ivy.el
index 01126d9..16b8d81 100644
--- 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)

Reply via email to