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

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

[elpa] externals/ivy-hydra 82cb9da 272/395: ivy.el (ivy--do-shrink-windo


From: Basil L. Contovounesios
Subject: [elpa] externals/ivy-hydra 82cb9da 272/395: ivy.el (ivy--do-shrink-window): Account for the extra prompt height
Date: Thu, 25 Feb 2021 08:32:18 -0500 (EST)

branch: externals/ivy-hydra
commit 82cb9daa7d75f5d7183382e2817c432b800453ac
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>

    ivy.el (ivy--do-shrink-window): Account for the extra prompt height
    
    Fixes #2501
---
 ivy.el | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index 1d48ebf..cc1d6d3 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3504,6 +3504,16 @@ height < `ivy-height', auto-shrink the minibuffer."
           :key-type symbol
           :value-type boolean))
 
+(defun ivy--do-shrink-window ()
+  (let ((h (save-excursion
+             (goto-char (minibuffer-prompt-end))
+             (let ((inhibit-field-text-motion t))
+               (line-number-at-pos)))))
+    (shrink-window (-
+                    (/ (window-body-height nil t)
+                       (frame-char-height))
+                    ivy--length h))))
+
 (defun ivy--resize-minibuffer-to-fit ()
   "Resize the minibuffer window size to fit the text in the minibuffer."
   (unless (or (frame-root-window-p (minibuffer-window))
@@ -3525,10 +3535,7 @@ height < `ivy-height', auto-shrink the minibuffer."
                             (ivy-alist-setting
                              ivy-auto-shrink-minibuffer-alist))
                         (< ivy--length ivy-height))
-                   (shrink-window (-
-                                   (/ (window-body-height nil t)
-                                      (frame-char-height))
-                                   ivy--length 1)))))
+                   (ivy--do-shrink-window))))
         (let ((text-height (count-screen-lines))
               (body-height (window-body-height)))
           (when (> text-height body-height)



reply via email to

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