[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/icomplete-vertical 066cec7 2/5: Improve formated size calculatio
From: |
Jimmy Aguilar Mena |
Subject: |
feature/icomplete-vertical 066cec7 2/5: Improve formated size calculation |
Date: |
Tue, 15 Sep 2020 05:32:42 -0400 (EDT) |
branch: feature/icomplete-vertical
commit 066cec70f6ec720c33d079d532903d371fab6ad4
Author: Jimmy Aguilar Mena <spacibba@aol.com>
Commit: Jimmy Aguilar Mena <spacibba@aol.com>
Improve formated size calculation
* lisp/icomplete.el (icomplete--vertical-prospects) :
(icomplete--horizontal-prospects) : Use pop and
icomplete--format-function
(icomplete-completions) : Not call icomplete--horizontal-prospects
because the input is already formatted.
---
lisp/icomplete.el | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index ac5efc9..76814b8 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -546,18 +546,14 @@ Conditions are:
limit prospects comp)
;; First candidate
- (when (and prefix-len
- icomplete-hide-common-prefix)
- (push (substring (car comps) prefix-len) prospects)
-
- (setq comps (cdr comps)
- prospects-rows-pixel (+ prospects-rows-pixel line-height)))
+ (when (and comps prefix-len icomplete-hide-common-prefix)
+ (push (icomplete--format-function (substring (pop comps) prefix-len))
prospects)
+ (setq prospects-rows-pixel (+ prospects-rows-pixel line-height)))
;; The others
(while (and comps (not limit))
- (setq comp (car comps)
- comps (cdr comps))
- (setq prospects-rows-pixel (+ prospects-rows-pixel line-height))
+ (setq comp (icomplete--format-function (substring (pop comps)
prefix-len))
+ prospects-rows-pixel (+ prospects-rows-pixel line-height))
(if (< prospects-rows-pixel prospects-max-height)
(push comp prospects)
@@ -614,6 +610,7 @@ Conditions are:
"List of horizontal completions limited."
(let* (;; Max total length to use, including the minibuffer content.
+ (separator-width (string-width icomplete--separator))
(prefix-len (and (stringp prefix)
;; Only hide the prefix if the corresponding info
;; is already displayed via `most'.
@@ -631,11 +628,9 @@ Conditions are:
limit prospects comp)
(while (and comps (not limit))
- (setq comp (substring (car comps) prefix-len)
- comps (cdr comps)
- prospects-len (+ (string-width comp)
- (string-width icomplete--separator)
- prospects-len))
+ (setq comp (icomplete--format-function (substring (pop comps)
prefix-len))
+ prospects-len (+ prospects-len (string-width comp)
separator-width))
+
(if (< prospects-len prospects-max-len)
(push comp prospects)
(push icomplete-ellipsis prospects)
@@ -972,8 +967,7 @@ minibuffer completion."
(when last (setcdr last base-size))
(if (or first prospects)
(format (concat determ first icomplete--separator
icomplete--list-indicators)
- (mapconcat
- #'icomplete--format-function prospects
icomplete--separator))
+ (mapconcat #'identity prospects icomplete--separator))
(concat determ " [Matched]"))))))
;;; Iswitchb compatibility