summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-11-04 23:32:03 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-11-04 23:35:51 +0100
commit028f7b0a239f0f6a8969fa4469040c3918f80abc (patch)
tree07568b0a1e589621fe370d461c1e7cc73aedc3c1
parent327a492c48cb9b01aea9aa2bd2c61df6f8d20c1d (diff)
Use the fringe symmetrically on both sides
-rw-r--r--corfu.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/corfu.el b/corfu.el
index 273df1e..309d039 100644
--- a/corfu.el
+++ b/corfu.el
@@ -1020,19 +1020,22 @@ A scroll bar is displayed from LO to LO+BAR."
(ml (min 16 (ceiling (* cw corfu-left-margin-width))))
(mr (min 16 (ceiling (* cw corfu-right-margin-width))))
(bw (min mr (ceiling (* cw corfu-scroll-bar-width))))
- (marginl (and (> ml 0) (propertize " " 'display `(space :width (,ml)))))
(fringe (display-graphic-p))
+ (marginl (and (not fringe) (propertize " " 'display `(space :width (,ml)))))
(sbar (if fringe
#(" " 0 1 (display (right-fringe corfu--bar corfu-scroll-bar)))
(concat (propertize " " 'display `(space :align-to (- right (,bw))))
(propertize " " 'face '(:inherit corfu-scroll-bar :inverse-video t)
'display `(space :width (,bw))))))
(cbar (if fringe
- #(" " 0 1 (display (right-fringe corfu--bar corfu--bar-cur)))
+ #(" " 0 1 (display (left-fringe corfu--nil corfu-current))
+ 1 2 (display (right-fringe corfu--bar corfu--bar-cur)))
sbar))
- (cmargin (and fringe #(" " 0 1 (display (right-fringe corfu--nil corfu-current)))))
+ (cmargin (and fringe
+ #(" " 0 1 (display (left-fringe corfu--nil corfu-current))
+ 1 2 (display (right-fringe corfu--nil corfu-current)))))
(pos (posn-x-y pos))
- (pwidth (+ (* width cw) ml (if fringe 0 mr)))
+ (pwidth (+ (* width cw) (if fringe 0 (+ ml mr))))
;; XXX HACK: Minimum popup height must be at least 1 line of the
;; parent frame (gh:minad/corfu#261).
(pheight (max lh (* (length lines) ch)))
@@ -1046,7 +1049,7 @@ A scroll bar is displayed from LO to LO+BAR."
yb))
(row 0)
(bmp (logxor (1- (ash 1 mr)) (1- (ash 1 bw)))))
- (setq right-fringe-width (if fringe mr 0))
+ (setq left-fringe-width (if fringe ml 0) right-fringe-width (if fringe mr 0))
(unless (or (= right-fringe-width 0) (eq (get 'corfu--bar 'corfu--bmp) bmp))
(put 'corfu--bar 'corfu--bmp bmp)
(define-fringe-bitmap 'corfu--bar (vector (lognot bmp)) 1 mr '(top periodic))