branch: externals/vertico
commit d2a7ed056cd79c4a763df2289057995cf360f6f0
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>

    Extract `vertico--resize-window`
    
    Check `frame-root-window-p` for mini-frame.el compatibility
---
 vertico.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/vertico.el b/vertico.el
index c63a738..df31d65 100644
--- a/vertico.el
+++ b/vertico.el
@@ -380,13 +380,18 @@
   (move-overlay vertico--candidates-ov (point-max) (point-max))
   (overlay-put vertico--candidates-ov 'after-string
                (apply #'concat #(" " 0 1 (cursor t)) (and lines "\n") lines))
-  (let* ((lh (default-line-height))
-         (resize (default-value 'resize-mini-windows))
-         (dp (- (max (cdr (window-text-pixel-size))
-                     (* lh (1+ (if resize (length lines) vertico-count))))
-                (window-pixel-height)))
-         (dl (ceiling dp lh)))
-    (when (or (> dl 0) (eq resize t)) (window-resize nil dl))))
+  (vertico--resize-window (length lines)))
+
+(defun vertico--resize-window (height)
+  "Resize active minibuffer window to HEIGHT."
+  (unless (frame-root-window-p (active-minibuffer-window))
+    (let* ((lh (default-line-height))
+           (resize (default-value 'resize-mini-windows))
+           (dp (- (max (cdr (window-text-pixel-size))
+                       (* lh (1+ (if resize height vertico-count))))
+                  (window-pixel-height)))
+           (dl (ceiling dp lh)))
+      (when (or (> dl 0) (eq resize t)) (window-resize nil dl)))))
 
 (defun vertico--display-count ()
   "Update count overlay `vertico--count-ov'."

Reply via email to