[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 94d95d2347 7/9: Move truncation back to corfu--fo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu 94d95d2347 7/9: Move truncation back to corfu--format-candidates |
Date: |
Tue, 5 Nov 2024 03:58:06 -0500 (EST) |
branch: externals/corfu
commit 94d95d2347ecfef6c65d0c03a9073de060b7c1c3
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Move truncation back to corfu--format-candidates
For backward compatibility, only on terminal.
---
corfu.el | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/corfu.el b/corfu.el
index 5bdfbc9432..0786e38885 100644
--- a/corfu.el
+++ b/corfu.el
@@ -738,20 +738,21 @@ FRAME is the existing frame."
(let* ((cw (cl-loop for x in cands maximize (string-width (car x))))
(pw (cl-loop for x in cands maximize (string-width (cadr x))))
(sw (cl-loop for x in cands maximize (string-width (caddr x))))
- (width (+ pw cw sw))
;; -4 because of margins and some additional safety
- (max-width (min corfu-max-width (- (frame-width) 4))))
- (setq width (min (max corfu-min-width width) max-width))
+ (max-width (min corfu-max-width (- (frame-width) 4)))
+ (width (min (max corfu-min-width (+ pw cw sw)) max-width))
+ (trunc (not (display-graphic-p))))
(list pw width
- (cl-loop for (cand prefix suffix) in cands collect
- (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)))))
+ (cl-loop
+ for (cand prefix suffix) in cands collect
+ (let ((s (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)))
+ (if trunc (truncate-string-to-width s width) s))))))
(defun corfu--compute-scroll ()
"Compute new scroll position."
@@ -1035,17 +1036,17 @@ A scroll bar is displayed from LO to LO+BAR."
#(" " 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) (if fringe 0 (+ ml mr))))
+ (width (+ (* 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)))
+ (height (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) pwidth))))
+ (- (frame-pixel-width) width))))
(yb (+ (cadr edge) (window-tab-line-height) (or (cdr pos) 0) lh))
(y (if (> (+ yb (* corfu-count ch) lh lh) (frame-pixel-height))
- (- yb pheight lh border border)
+ (- yb height lh border border)
yb))
(row 0)
(bmp (logxor (1- (ash 1 mr)) (1- (ash 1 bw)))))
@@ -1067,8 +1068,7 @@ A scroll bar is displayed from LO to LO+BAR."
(apply #'insert
(cl-loop for line in lines collect
(let ((str (concat
- marginl
- (if fringe line (truncate-string-to-width line
width))
+ marginl line
(if (and lo (<= lo row (+ lo bar)))
(if (eq row curr) cbar sbar)
(and (eq row curr) cmargin))
@@ -1079,7 +1079,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 pwidth
pheight))))))
+ (setq corfu--frame (corfu--make-frame corfu--frame x y width
height))))))
(cl-defgeneric corfu--popup-hide ()
"Hide Corfu popup."
- [elpa] externals/corfu updated (44424e7d04 -> 37d4ed3ca0), ELPA Syncer, 2024/11/05
- [elpa] externals/corfu 08c3aeb46c 1/9: Avoid truncation if scrollbar is shown in the fringe, ELPA Syncer, 2024/11/05
- [elpa] externals/corfu 41ec0baa6b 2/9: Make right margin part of the fringe, ELPA Syncer, 2024/11/05
- [elpa] externals/corfu d7c2fabbc6 3/9: Fringe bitmaps have a width restriction 1 <= w <= 16, ELPA Syncer, 2024/11/05
- [elpa] externals/corfu a297daee27 4/9: Restrict the fringe width to 16, ELPA Syncer, 2024/11/05
- [elpa] externals/corfu 09e70155c2 5/9: Use the fringe symmetrically on both sides, ELPA Syncer, 2024/11/05
- [elpa] externals/corfu 94d95d2347 7/9: Move truncation back to corfu--format-candidates,
ELPA Syncer <=
- [elpa] externals/corfu 23509b6fd3 8/9: Expand comment regarding HDPi systems, ELPA Syncer, 2024/11/05
- [elpa] externals/corfu dc85ee32eb 6/9: Preserve corfu-bar-width and corfu-bar face for compatibility, ELPA Syncer, 2024/11/05
- [elpa] externals/corfu 37d4ed3ca0 9/9: Reduce popup width fluctuations, ELPA Syncer, 2024/11/05