summaryrefslogtreecommitdiff
path: root/corfu.el
diff options
context:
space:
mode:
Diffstat (limited to 'corfu.el')
-rw-r--r--corfu.el31
1 files changed, 15 insertions, 16 deletions
diff --git a/corfu.el b/corfu.el
index 468a4de..f5bb52d 100644
--- a/corfu.el
+++ b/corfu.el
@@ -744,16 +744,14 @@ FRAME is the existing frame."
(setq width (min (max corfu-min-width width) max-width))
(list pw width
(cl-loop for (cand prefix suffix) in cands collect
- (truncate-string-to-width
- (concat
- prefix (make-string (- pw (string-width prefix)) ?\s)
- cand
- (when (> sw 0)
- (make-string (max 0 (- width pw (string-width cand)
- (string-width suffix)))
- ?\s))
- suffix)
- width)))))
+ (concat
+ prefix (make-string (- pw (string-width prefix)) ?\s)
+ cand
+ (when (> sw 0)
+ (make-string (max 0 (- width pw (string-width cand)
+ (string-width suffix)))
+ ?\s))
+ suffix)))))
(defun corfu--compute-scroll ()
"Compute new scroll position."
@@ -1028,17 +1026,17 @@ A scroll bar is displayed from LO to LO+BAR."
(propertize " " 'face 'corfu-bar 'display `(space :width (,bw))))))
(cbar (and fringe #(" " 0 1 (display (right-fringe corfu--bar corfu-current)))))
(pos (posn-x-y pos))
- (width (+ (* width cw) ml mr (if fringe (- bw) 0)))
+ (pwidth (+ (* width cw) ml mr (if fringe (- bw) 0)))
;; XXX HACK: Minimum popup height must be at least 1 line of the
;; parent frame (gh:minad/corfu#261).
- (height (max lh (* (length lines) ch)))
+ (pheight (max lh (* (length lines) ch)))
(edge (window-inside-pixel-edges))
(border (alist-get 'internal-border-width corfu--frame-parameters))
(x (max 0 (min (+ (car edge) (- (or (car pos) 0) ml (* cw off) border))
- (- (frame-pixel-width) width))))
+ (- (frame-pixel-width) pwidth))))
(yb (+ (cadr edge) (window-tab-line-height) (or (cdr pos) 0) lh))
(y (if (> (+ yb (* corfu-count ch) lh lh) (frame-pixel-height))
- (- yb height lh border border)
+ (- yb pheight lh border border)
yb))
(row 0))
(setq right-fringe-width (if fringe bw 0))
@@ -1049,7 +1047,8 @@ A scroll bar is displayed from LO to LO+BAR."
(apply #'insert
(cl-loop for line in lines collect
(let ((str (concat
- marginl line
+ marginl
+ (if fringe line (truncate-string-to-width line width))
(or (and lo (<= lo row (+ lo bar)) sbar)
(and (eq row curr) cbar))
"\n")))
@@ -1059,7 +1058,7 @@ A scroll bar is displayed from LO to LO+BAR."
(cl-incf row)
str)))
(goto-char (point-min)))
- (setq corfu--frame (corfu--make-frame corfu--frame x y width height))))))
+ (setq corfu--frame (corfu--make-frame corfu--frame x y pwidth pheight))))))
(cl-defgeneric corfu--popup-hide ()
"Hide Corfu popup."