[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu a56e80e: Eglot seems to return candidates with ne
From: |
Protesilaos Stavrou |
Subject: |
[elpa] externals/corfu a56e80e: Eglot seems to return candidates with newlines |
Date: |
Wed, 19 May 2021 15:59:00 -0400 (EDT) |
branch: externals/corfu
commit a56e80e152a555afebe6b8ca1d0963ce4cb93b5f
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Eglot seems to return candidates with newlines
Remove alignment code for now. First I have to understand better the
different
formats returned from the backends.
---
corfu.el | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/corfu.el b/corfu.el
index 3dcfeb3..ef403f7 100644
--- a/corfu.el
+++ b/corfu.el
@@ -436,19 +436,16 @@ Set to nil in order to disable confirmation."
"Return PROP from METADATA."
(cdr (assq prop metadata)))
-(defun corfu--format-candidate ()
- "Format candidates."
- (let ((mw (ceiling (* corfu-margin-width (frame-char-width)))))
- (lambda (c)
- (if (consp c)
- (concat
- (cadr c) (car c)
- (propertize " " 'display
- `(space :align-to (- right ,(length (caddr c)) (,mw))))
- (if (text-property-not-all 0 (length (caddr c)) 'face nil (caddr c))
- (caddr c)
- (propertize (caddr c) 'face 'completions-annotations)))
- c))))
+(defun corfu--format-candidate (cand)
+ "Format annotated CAND string."
+ (replace-regexp-in-string
+ "[ \t]*\n[ \t]*" " "
+ (if (consp cand)
+ (concat (cadr cand) (car cand)
+ (if (text-property-not-all 0 (length (caddr cand)) 'face nil
(caddr cand))
+ (caddr cand)
+ (propertize (caddr cand) 'face 'completions-annotations)))
+ cand)))
(defun corfu--show-candidates (beg end str metadata)
"Update display given BEG, END, STR and METADATA."
@@ -459,7 +456,7 @@ Set to nil in order to disable confirmation."
(bar (ceiling (* corfu-count corfu-count) corfu--total))
(lo (min (- corfu-count bar 1) (floor (* corfu-count start)
corfu--total)))
(cands (funcall corfu--highlight (seq-subseq corfu--candidates start
last)))
- (ann-cands (mapcar (corfu--format-candidate) (corfu--annotate
metadata cands))))
+ (ann-cands (mapcar #'corfu--format-candidate (corfu--annotate
metadata cands))))
;; Nonlinearity at the end and the beginning
(when (/= start 0)
(setq lo (max 1 lo)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/corfu a56e80e: Eglot seems to return candidates with newlines,
Protesilaos Stavrou <=