[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu 4e58a71 04/14: Minor optimizations
From: |
Protesilaos Stavrou |
Subject: |
[elpa] externals/corfu 4e58a71 04/14: Minor optimizations |
Date: |
Sat, 17 Apr 2021 10:25:41 -0400 (EDT) |
branch: externals/corfu
commit 4e58a715a7900a26c28da34266671df61d60b513
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Minor optimizations
---
corfu.el | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/corfu.el b/corfu.el
index 5e3c1e1..c667a32 100644
--- a/corfu.el
+++ b/corfu.el
@@ -159,9 +159,9 @@
;; XXX Is there a better way to generate an image? Bitmap vector?
(defun corfu--border (w h color width)
"Generate border with COLOR and WIDTH and image size W*H."
- (let ((row (funcall (if (< width 0) #'reverse #'identity)
- (concat (make-string (abs width) ?0)
- (make-string (- w (abs width)) ?1)))))
+ (let ((row (if (< width 0)
+ (concat (make-string (- w (- width)) ?1) (make-string (-
width) ?0))
+ (concat (make-string width ?0) (make-string (- w width) ?1)))))
(propertize
" " 'display
`(image :data ,(format "P1\n%s %s\n%s" w h
@@ -180,7 +180,8 @@
(rbar (corfu--border (car size) (cdr size) 'corfu-bar (- (ceiling
(car size) 3))))
(col (+ (- pos (line-beginning-position)) corfu--base))
(max-width (min (/ (window-total-width) 2) (- (window-total-width)
col 4)))
- (pixel-pos (cdr (window-absolute-pixel-position pos)))
+ (ypos (- (line-number-at-pos pos)
+ (save-excursion (move-to-window-line 0)
(line-number-at-pos))))
(count (length lines))
(row 0) (width) (formatted) (beg))
(if (< max-width corfu-min-width)
@@ -192,8 +193,8 @@
width (apply #'max corfu-min-width (mapcar #'string-width lines))))
(save-excursion
(beginning-of-line)
- (forward-line (if (and (>= count (floor (- (window-pixel-height)
pixel-pos) (cdr size)))
- (< count (floor pixel-pos (cdr size))))
+ (forward-line (if (and (< count ypos)
+ (>= count (- (floor (window-pixel-height) (cdr
size)) ypos 1)))
(- count) 1))
(setq beg (point))
(when (save-excursion
- [elpa] externals/corfu updated (7bab236 -> 4c2c997), Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 53ecf48 03/14: corfu-show-location/documentation: Add error messages, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 4e58a71 04/14: Minor optimizations,
Protesilaos Stavrou <=
- [elpa] externals/corfu ff1579e 11/14: README: Add link to ELPA, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 2ebd35f 12/14: corfu-map: Bind M-n and M-p, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 4c2c997 14/14: Version 0.2, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 41eb724 02/14: Ignore corfu-abort if documentation/location window is shown, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 82474fb 01/14: Fix typo in corfu-minor-mode, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 7fcd09b 08/14: README: Update caveat, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 6e9b8ef 10/14: Add corfu-completion-styles, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu 10660b4 07/14: corfu-first: Jump to the prompt if first candidate is selected, Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu cf7c6c9 05/14: Do not show annotation in candidate preview (See #2), Protesilaos Stavrou, 2021/04/17
- [elpa] externals/corfu cca1eaf 09/14: Extract corfu--move-prefix-candidates-to-front, Protesilaos Stavrou, 2021/04/17