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

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

[elpa] externals/corfu 17811b2d35 1/2: corfu-popupinfo: Fix todo


From: ELPA Syncer
Subject: [elpa] externals/corfu 17811b2d35 1/2: corfu-popupinfo: Fix todo
Date: Fri, 18 Nov 2022 16:57:26 -0500 (EST)

branch: externals/corfu
commit 17811b2d3518670fd9e4a419208730a30d21fe41
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    corfu-popupinfo: Fix todo
---
 extensions/corfu-popupinfo.el | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el
index 74b79a0b23..7806846334 100644
--- a/extensions/corfu-popupinfo.el
+++ b/extensions/corfu-popupinfo.el
@@ -180,9 +180,8 @@ all values are in pixels relative to the origin. See
                  (buffer-string)))
       (and (not (string-blank-p res)) res))))
 
-;; TODO return pair, not list?
 (defun corfu-popupinfo--size ()
-  "Calculate popup size in the form of (width height)."
+  "Return popup size as pair."
   (let ((max-width (* (frame-char-width) corfu-popupinfo-max-width))
         (max-height (* (default-line-height) corfu-popupinfo-max-height)))
     (if corfu-popupinfo-resize
@@ -193,8 +192,8 @@ all values are in pixels relative to the origin. See
                          (set-window-buffer nil (current-buffer))
                          (window-text-pixel-size nil (point-min) (point-max)
                                                  (* 2 max-width) (* 2 
max-height))))))
-          (list (min width max-width) (min height max-height)))
-      (list max-width max-height))))
+          (cons (min width max-width) (min height max-height)))
+      (cons max-width max-height))))
 
 (defun corfu-popupinfo--frame-geometry (frame)
   "Return position and size geometric attributes of FRAME.
@@ -285,15 +284,15 @@ the candidate popup, its value is 'bottom, 'top, 'right 
or 'left."
   ;; TODO wrong
   (cond
    ((member direction '(right left))
-    (apply #'corfu-popupinfo--display-area-horizontal
-           (corfu-popupinfo--size)))
+    (let ((size (corfu-popupinfo--size)))
+      (corfu-popupinfo--display-area-horizontal (car size) (cdr size))))
    ((member direction '(bottom top))
-    (apply #'corfu-popupinfo--display-area-vertical
-           (corfu-popupinfo--size)))
+    (let ((size (corfu-popupinfo--size)))
+      (corfu-popupinfo--display-area-vertical (car size) (cdr size))))
    (t
-    (pcase-let* ((`(,width ,height)
+    (pcase-let* ((`(,width . ,height)
                   (if (and width height)
-                      (list width height)
+                      (cons width height)
                     (corfu-popupinfo--size)))
                  ((and h-a `(,_h-x ,_h-y ,h-w ,h-h ,_h-d))
                   (corfu-popupinfo--display-area-horizontal width height))



reply via email to

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