[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vertico c9a28d1 4/6: Minor simplifications
From: |
Protesilaos Stavrou |
Subject: |
[elpa] externals/vertico c9a28d1 4/6: Minor simplifications |
Date: |
Thu, 8 Apr 2021 11:54:23 -0400 (EDT) |
branch: externals/vertico
commit c9a28d1583e1ad39e7f17c7532a8fa45c08f7e8e
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Minor simplifications
---
vertico.el | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/vertico.el b/vertico.el
index afa37ad..f29a146 100644
--- a/vertico.el
+++ b/vertico.el
@@ -192,13 +192,13 @@
(setcar cand (cons (car cand)
(+ (lsh (gethash (car cand) vertico--history-hash
#xFFFF) 13)
(length (car cand)))))
- (setq cand (cdr cand))))
+ (pop cand)))
(setq candidates (sort candidates #'vertico--sort-predicate))
;; Drop decoration from the candidates
(let ((cand candidates))
(while cand
(setcar cand (caar cand))
- (setq cand (cdr cand))))
+ (pop cand)))
candidates)
(defun vertico--annotate (metadata candidates)
@@ -323,19 +323,18 @@
(vertico--highlight (vertico--input-after-boundary input) metadata)
(vertico--annotate metadata)))
(max-width (- (window-width) 4))
- (title)
- (chunks (and (eobp) (list #(" " 0 1 (cursor t)))))
- (group (completion-metadata-get metadata 'x-group-function)))
+ (group (completion-metadata-get metadata 'x-group-function))
+ (title) (chunks))
(dolist (ann-cand candidates)
- (push (if (= index (1+ vertico--index))
- #("\n" 0 1 (face vertico-current))
- "\n")
- chunks)
- (let ((prefix "") (suffix "") (cand))
- (pcase ann-cand
- (`(,c ,s) (setq cand c suffix s))
- (`(,c ,p ,s) (setq cand c prefix p suffix s))
- (_ (setq cand ann-cand)))
+ (let* ((prefix "") (suffix "")
+ (cand (pcase ann-cand
+ (`(,c ,s) (setq suffix s) c)
+ (`(,c ,p ,s) (setq prefix p suffix s) c)
+ (c c))))
+ (push (if (= index (1+ vertico--index))
+ #("\n" 0 1 (face vertico-current))
+ "\n")
+ chunks)
(when-let (new-title (and vertico-group-format group (caar (funcall
group (list cand)))))
(unless (equal title new-title)
(push (format vertico-group-format new-title) chunks)
@@ -356,7 +355,7 @@
(add-face-text-property 0 (length cand) 'vertico-current 'append
cand))
(push cand chunks)
(setq index (1+ index))))
- (apply #'concat (nreverse chunks))))
+ (apply #'concat (and (eobp) #(" " 0 1 (cursor t))) (nreverse chunks))))
(defun vertico--display-candidates (str)
"Update candidates overlay `vertico--candidates-ov' with STR."
- [elpa] externals/vertico updated (82ed224 -> 1fc43bb), Protesilaos Stavrou, 2021/04/08
- [elpa] externals/vertico 18fae58 1/6: Fix #4 - Select prompt if `test-completion` succeeds for the input, Protesilaos Stavrou, 2021/04/08
- [elpa] externals/vertico b94e577 3/6: Truncate multi line candidates to a single line, Protesilaos Stavrou, 2021/04/08
- [elpa] externals/vertico 1fc43bb 6/6: Version 0.2, Protesilaos Stavrou, 2021/04/08
- [elpa] externals/vertico 5e5192f 2/6: Improve prompt selection, Protesilaos Stavrou, 2021/04/08
- [elpa] externals/vertico 24fab0b 5/6: Avoid window resizing - ensure that we never show more than 10 lines, Protesilaos Stavrou, 2021/04/08
- [elpa] externals/vertico c9a28d1 4/6: Minor simplifications,
Protesilaos Stavrou <=