From 67be3fbda2325c9e93fcfaa4ac7d49ce88bb6da5 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Thu, 29 Apr 2021 15:57:24 +0200 Subject: Add corfu-bar-width/corfu-margin-width customizable variables This allows to scale scrollbar and margins according to your preference. Setting the width to 0 is supported. See #1 and #7. --- corfu.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/corfu.el b/corfu.el index 4607719..ffe41b1 100644 --- a/corfu.el +++ b/corfu.el @@ -65,6 +65,14 @@ Set to nil in order to disable confirmation." "List of modes excluded by `corfu-global-mode'." :type '(repeat symbol)) +(defcustom corfu-margin-width 0.6 + "Width of the margin in units of the character width." + :type 'float) + +(defcustom corfu-bar-width 0.25 + "Width of the bar in units of the character width." + :type 'float) + (defgroup corfu-faces nil "Faces used by Corfu." :group 'corfu @@ -235,10 +243,13 @@ Set to nil in order to disable confirmation." "Show LINES as popup at POS, with CURR highlighted and scrollbar from LO to LO+BAR." (let* ((cw (frame-char-width)) (ch (frame-char-height)) - (mw (ceiling cw 1.6)) + (mw (ceiling (* cw corfu-margin-width))) + (bw (ceiling (* cw (min corfu-margin-width corfu-bar-width)))) (margin (propertize " " 'display `(space :width (,mw)))) - (align (propertize " " 'display `(space :align-to (- right (,(ceiling cw 4)))))) - (sbar (propertize " " 'face 'corfu-bar 'display `(space :width (,(ceiling cw 4))))) + (align (propertize " " 'display `(space :align-to (- right (,mw))))) + (sbar (concat + (propertize " " 'display `(space :width (,(- mw bw)))) + (propertize " " 'face 'corfu-bar 'display `(space :width (,bw))))) (width (min (cdr corfu-width-limits) (/ (frame-width) 2) (apply #'max (car corfu-width-limits) -- cgit v1.0