summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2021-04-29 16:01:18 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2021-04-29 16:01:18 +0200
commitbed95134c319d95466818f52ce4f0586c67d8c2c (patch)
tree2c1f5aacf7df3ebcc1291aa67956a051915cc68f
parent67be3fbda2325c9e93fcfaa4ac7d49ce88bb6da5 (diff)
Add corfu-min/max-width for easier customization
-rw-r--r--corfu.el15
1 files changed, 9 insertions, 6 deletions
diff --git a/corfu.el b/corfu.el
index ffe41b1..b6c3688 100644
--- a/corfu.el
+++ b/corfu.el
@@ -47,10 +47,13 @@
"Maximal number of candidates to show."
:type 'integer)
-(defcustom corfu-width-limits
- (cons 15 80)
- "Popup width limits."
- :type '(cons integer integer))
+(defcustom corfu-min-width 15
+ "Popup minimum width in characters."
+ :type 'integer)
+
+(defcustom corfu-max-width 100
+ "Popup maximum width in characters."
+ :type 'integer)
(defcustom corfu-cycle nil
"Enable cycling for `corfu-next' and `corfu-previous'."
@@ -250,9 +253,9 @@ Set to nil in order to disable confirmation."
(sbar (concat
(propertize " " 'display `(space :width (,(- mw bw))))
(propertize " " 'face 'corfu-bar 'display `(space :width (,bw)))))
- (width (min (cdr corfu-width-limits)
+ (width (min corfu-max-width
(/ (frame-width) 2)
- (apply #'max (car corfu-width-limits)
+ (apply #'max corfu-min-width
(mapcar #'string-width lines))))
(row 0)
(pos (posn-x-y (posn-at-point pos))))