emacs-diffs
[Top][All Lists]
Advanced

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

feature/icomplete-vertical 1e0ad0d: Improve vertical height calculation


From: Jimmy Aguilar Mena
Subject: feature/icomplete-vertical 1e0ad0d: Improve vertical height calculation when not in minibuffer
Date: Tue, 15 Sep 2020 02:47:21 -0400 (EDT)

branch: feature/icomplete-vertical
commit 1e0ad0d5c6c756dc1ee2064e2e2cf423b62e5d55
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>

    Improve vertical height calculation when not in minibuffer
    
    * lisp/icomplete.el (icomplete--vertical-get-max-height): new function
    to calculate the vertical-max-height.
---
 lisp/icomplete.el | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index ef46fd5..3d6e649 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -516,6 +516,20 @@ Conditions are:
     map)
   "Keymap used by `fido-mode' and `icomplete-mode' in 
`icomplete-vertical-mode'.")
 
+(defun icomplete--vertical-get-max-height ()
+  (let ((minibuffer-parameter (frame-parameter nil 'minibuffer)))
+    (cond
+     ((eq minibuffer-parameter t)
+      (cond ((floatp max-mini-window-height)
+            (floor (* max-mini-window-height (frame-pixel-height))))
+           ((integerp max-mini-window-height)
+            (floor (* max-mini-window-height line-height)))
+           (t
+             (* icomplete-prospects-height line-height))))
+     ((eq minibuffer-parameter 'only)
+      (frame-pixel-height))
+     ;; TODO: minibuffer-parameter can also be a window or a frame; Add 
conditions framep and windowp
+     )))
 
 (defun icomplete--vertical-prospects (match-braket prefix most _determ comps)
   "List of vertical completions limited."
@@ -526,12 +540,7 @@ Conditions are:
                           (string-prefix-p prefix most t)
                           (length prefix)))
          (line-height (line-pixel-height))
-         (prospects-max-height (cond ((floatp max-mini-window-height)
-                                     (floor (* max-mini-window-height 
(frame-pixel-height))))
-                                    ((integerp max-mini-window-height)
-                                     (floor (* max-mini-window-height 
line-height)))
-                                    (t
-                                      (* icomplete-prospects-height 
line-height))))
+         (prospects-max-height icomplete--vertical-get-max-height)
          ;; prompt + row new line around match
          (prospects-rows-pixel (* (1+ (cl-count ?\n match-braket)) 
line-height))
          limit prospects comp)



reply via email to

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