emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/company ebfe83e 1/2: Fix quick-access numbers shown in


From: ELPA Syncer
Subject: [elpa] externals/company ebfe83e 1/2: Fix quick-access numbers shown in echo frontends
Date: Thu, 3 Jun 2021 06:57:07 -0400 (EDT)

branch: externals/company
commit ebfe83ec23fbe74dc8db41dd59808db94d06e371
Author: Y. E <yugenekr@gmail.com>
Commit: Y. E <yugenekr@gmail.com>

    Fix quick-access numbers shown in echo frontends
    
    Replaces zero-based digits by quick-access bindings digits.
    Discussed in #1104.
---
 company.el | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/company.el b/company.el
index 290416e..2dcfd8d 100644
--- a/company.el
+++ b/company.el
@@ -3564,19 +3564,18 @@ Delay is determined by `company-tooltip-idle-delay'."
           (len -1)
           ;; Roll to selection.
           (candidates (nthcdr selection company-candidates))
-          (i (if company-show-numbers selection 99999))
+          (numbered (if company-show-numbers selection 99999))
           comp msg)
 
       (while candidates
         (setq comp (company-reformat (company--clean-string (pop candidates)))
               len (+ len 1 (length comp)))
-        (if (< i 10)
-            ;; Add number.
+        (if (< numbered 10)
             (progn
-              (setq comp (propertize (format "%d: %s" i comp)
+              (cl-incf numbered)
+              (setq comp (propertize (format "%d: %s" (mod numbered 10) comp)
                                      'face 'company-echo))
               (cl-incf len 3)
-              (cl-incf i)
               ;; FIXME: Add support for the `match' backend action, and thus,
               ;; non-prefix matches.
               (add-text-properties 3 (+ 3 (string-width (or company-common 
"")))
@@ -3596,17 +3595,16 @@ Delay is determined by `company-tooltip-idle-delay'."
           (len (+ (length company-prefix) 2))
           ;; Roll to selection.
           (candidates (nthcdr selection company-candidates))
-          (i (if company-show-numbers selection 99999))
+          (numbered (if company-show-numbers selection 99999))
           msg comp)
 
       (while candidates
         (setq comp (company-strip-prefix (pop candidates))
               len (+ len 2 (length comp)))
-        (when (< i 10)
-          ;; Add number.
-          (setq comp (format "%s (%d)" comp i))
-          (cl-incf len 4)
-          (cl-incf i))
+        (when (< numbered 10)
+          (cl-incf numbered)
+          (setq comp (format "%s (%d)" comp (mod numbered 10)))
+          (cl-incf len 4))
         (if (>= len limit)
             (setq candidates nil)
           (push (propertize comp 'face 'company-echo) msg)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]