summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgaleo <galeo@users.noreply.github.com>2022-11-24 21:47:37 +0800
committerGitHub <noreply@github.com>2022-11-24 14:47:37 +0100
commit4a6e5df2fb139d8402b4171b2f036b3a12372230 (patch)
treef86b9ad52bd1a5c681b81bc163b4b745b40dc56a
parent12be10d8806103327b4a4a6027a418d414414f1c (diff)
corfu-popupinfo: Make sure the popup has a minimum height of 1 line (#261)
-rw-r--r--extensions/corfu-popupinfo.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el
index d82d124..0eba027 100644
--- a/extensions/corfu-popupinfo.el
+++ b/extensions/corfu-popupinfo.el
@@ -219,9 +219,10 @@ all values are in pixels relative to the origin. See
(defun corfu-popupinfo--size ()
"Return popup size as pair."
(let* ((cw (default-font-width))
+ (lh (default-line-height))
(margin (* cw (+ (alist-get 'left-margin-width corfu-popupinfo--buffer-parameters)
(alist-get 'right-margin-width corfu-popupinfo--buffer-parameters))))
- (max-height (* (default-line-height) corfu-popupinfo-max-height))
+ (max-height (* lh corfu-popupinfo-max-height))
(max-width (* cw corfu-popupinfo-max-width)))
(or (when corfu-popupinfo-resize
(with-current-buffer " *corfu-popupinfo*"
@@ -233,7 +234,8 @@ all values are in pixels relative to the origin. See
;; Check that width is not exceeded. Otherwise use full height,
;; since lines will get wrapped.
(when (<= (car size) max-width)
- (cons (+ margin (car size)) (min (cdr size) max-height))))))
+ (cons (+ margin (car size))
+ (min (max (cdr size) lh) max-height))))))
(cons (+ margin max-width) max-height))))
(defun corfu-popupinfo--frame-geometry (frame)