summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2025-12-20 16:41:47 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2025-12-20 16:41:47 +0100
commit439f37ef69161a97fbf8d9389e1b10ca92f8a48b (patch)
treec64ca8fc1aa48c881ae5f38b00735001791a66ab /extensions
parent5d083b7be7e6497b02148bdaa6ec4559b5a3f59d (diff)
corfu-popupinfo-margin-width: New customizable
Diffstat (limited to 'extensions')
-rw-r--r--extensions/corfu-popupinfo.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el
index 5187957..48ba909 100644
--- a/extensions/corfu-popupinfo.el
+++ b/extensions/corfu-popupinfo.el
@@ -79,6 +79,11 @@ documentation from the backend is usually expensive."
:type 'boolean
:group 'corfu)
+(defcustom corfu-popupinfo-margin-width 1
+ "Margin at the left and right side of the popup."
+ :type 'natnum
+ :group 'corfu)
+
(defcustom corfu-popupinfo-max-width 80
"The maximum width of the info popup in characters."
:type 'natnum
@@ -129,11 +134,10 @@ documentation from the backend is usually expensive."
(defvar corfu-popupinfo--buffer-parameters
'((truncate-partial-width-windows . nil)
(truncate-lines . nil)
- (left-margin-width . 1)
- (right-margin-width . 1)
(word-wrap . t)
(char-property-alias-alist (face font-lock-face)))
- "Buffer parameters.")
+ "Additional child frame buffer parameters.
+It is recommended to avoid changing these parameters.")
(defvar corfu-popupinfo--frame nil
"Info popup child frame.")
@@ -246,9 +250,7 @@ all values are in pixels relative to the origin. See
"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))))
+ (margin (* cw (* 2 corfu-popupinfo-margin-width)))
(max-height (* lh corfu-popupinfo-max-height))
(max-width (* cw corfu-popupinfo-max-width)))
(or (when corfu-popupinfo-resize
@@ -366,6 +368,8 @@ form (X Y WIDTH HEIGHT DIR)."
(goto-char (point-min)))
(dolist (var corfu-popupinfo--buffer-parameters)
(set (make-local-variable (car var)) (cdr var)))
+ (setq-local left-margin-width corfu-popupinfo-margin-width
+ right-margin-width corfu-popupinfo-margin-width)
(when-let ((m (memq 'corfu-default (alist-get 'default face-remapping-alist))))
(setcar m 'corfu-popupinfo)))
(corfu-popupinfo--hide)