[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vertico 145b2cc278 1/2: Revert "Use pixelwise computati
From: |
ELPA Syncer |
Subject: |
[elpa] externals/vertico 145b2cc278 1/2: Revert "Use pixelwise computation for truncate-lines (Fix #343)" |
Date: |
Sat, 25 Mar 2023 14:00:17 -0400 (EDT) |
branch: externals/vertico
commit 145b2cc278f0e47aab96cbde9ecc2afd44035821
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Revert "Use pixelwise computation for truncate-lines (Fix #343)"
This reverts commit a630913a41b2123017d056b82859db611c47710d.
This reverts commit 74dc59c101a82b6e0324b2939abea8d0c32f607b.
This reverts commit febc71a3171915d85d0ba7211b21e73967e7f5d9.
I had already suspected that pixelwise computation could led to problems,
since
the overlay is taken into account. Fix #345.
---
CHANGELOG.org | 3 ---
extensions/vertico-buffer.el | 7 +++----
vertico.el | 20 ++++++++++----------
3 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index bb2199f8b3..8746a3e6cb 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -4,9 +4,6 @@
* Development
-- Use pixel-wise computation to determine if =truncate-lines= should be set. If
- point is too far too the right of the window, line truncation is disabled
such
- that the full prompt is visible.
- =vertico-buffer-display=: Add more choices for the display action to the
customizable variable.
diff --git a/extensions/vertico-buffer.el b/extensions/vertico-buffer.el
index 9eb7b73cab..5f066f1c2a 100644
--- a/extensions/vertico-buffer.el
+++ b/extensions/vertico-buffer.el
@@ -90,11 +90,10 @@
(when-let (mbwin (active-minibuffer-window))
(when (eq (window-buffer mbwin) (current-buffer))
(unless (eq win mbwin)
+ (setq-local truncate-lines (< (window-point win)
+ (* 0.8 (window-width win))))
(set-window-point win (point))
- (set-window-hscroll win 0)
- (setq-local truncate-lines
- (< (car (window-text-pixel-size win (point-min) (point) t
1))
- (* 0.8 (window-width win 'pixelwise)))))
+ (set-window-hscroll win 0))
(when vertico-buffer-hide-prompt
(window-resize mbwin (- (window-pixel-height mbwin)) nil nil
'pixelwise)
(set-window-vscroll mbwin 100))
diff --git a/vertico.el b/vertico.el
index 1db9e6fb67..d5f6e784b6 100644
--- a/vertico.el
+++ b/vertico.el
@@ -457,9 +457,9 @@ The function is configured by BY, BSIZE, BINDEX, BPRED and
PRED."
(setq pos nexti))))))
(if chunks (apply #'concat (nreverse chunks)) str)))
-(defun vertico--window-width (&optional pixel)
- "Return minimum width of minibuffer windows, optionally in PIXEL."
- (cl-loop for win in (get-buffer-window-list) minimize (window-width win
pixel)))
+(defun vertico--window-width ()
+ "Return minimum width of windows, which display the minibuffer."
+ (cl-loop for win in (get-buffer-window-list) minimize (window-width win)))
(defun vertico--truncate-multiline (cand max-width)
"Truncate multiline CAND to MAX-WIDTH."
@@ -614,16 +614,16 @@ The function is configured by BY, BSIZE, BINDEX, BPRED
and PRED."
(cl-defgeneric vertico--resize-window (height)
"Resize active minibuffer window to HEIGHT."
- (setq-local truncate-lines
- (< (car (window-text-pixel-size nil (point-min) (point) t 1))
- (* 0.8 (vertico--window-width 'pixelwise)))
+ (setq-local truncate-lines (< (point) (* 0.8 (vertico--window-width)))
resize-mini-windows 'grow-only
max-mini-window-height 1.0)
(unless (frame-root-window-p (active-minibuffer-window))
- (unless vertico-resize (setq height (max height vertico-count)))
- (let ((dp (- (max (cdr (window-text-pixel-size))
- (* (default-line-height) (1+ height)))
- (window-pixel-height))))
+ (unless vertico-resize
+ (setq height (max height vertico-count)))
+ (let* ((window-resize-pixelwise t)
+ (dp (- (max (cdr (window-text-pixel-size))
+ (* (default-line-height) (1+ height)))
+ (window-pixel-height))))
(when (or (and (> dp 0) (/= height 0))
(and (< dp 0) (eq vertico-resize t)))
(window-resize nil dp nil nil 'pixelwise)))))