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

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

[elpa] externals/corfu 67be3fb 3/6: Add corfu-bar-width/corfu-margin-wid


From: Protesilaos Stavrou
Subject: [elpa] externals/corfu 67be3fb 3/6: Add corfu-bar-width/corfu-margin-width customizable variables
Date: Thu, 29 Apr 2021 13:38:53 -0400 (EDT)

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

    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)



reply via email to

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