[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/company 68404f0 1/2: Make numbers-on-the-left work toge
From: |
ELPA Syncer |
Subject: |
[elpa] externals/company 68404f0 1/2: Make numbers-on-the-left work together with icons |
Date: |
Mon, 29 Mar 2021 12:57:06 -0400 (EDT) |
branch: externals/company
commit 68404f0b8e032a935d383936b4272723244f4709
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Make numbers-on-the-left work together with icons
Fixes #1078
---
company.el | 3 +--
test/frontends-tests.el | 10 ++++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/company.el b/company.el
index b2d1c5e..3568029 100644
--- a/company.el
+++ b/company.el
@@ -2980,7 +2980,6 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(str (car item))
(annotation (cadr item))
(left (nth 2 item))
- (margin (company-space-string company-tooltip-margin))
(right (company-space-string company-tooltip-margin))
(width width))
(when (< numbered 10)
@@ -2988,7 +2987,7 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(cl-incf numbered)
(setf (if (eq company-show-numbers 'left) left right)
(concat (funcall company-show-numbers-function numbered)
- margin)))
+ (if (eq company-show-numbers 'left) left right))))
(push (concat
(company-fill-propertize str annotation
width (equal i selection)
diff --git a/test/frontends-tests.el b/test/frontends-tests.el
index 8a69033..14bb965 100644
--- a/test/frontends-tests.el
+++ b/test/frontends-tests.el
@@ -147,6 +147,16 @@
(should (equal '(" 1 x " " 2 y " " 3 z ")
(company--create-lines 0 999)))))
+(ert-deftest company-create-lines-combines-numbers-on-the-left-and-icons ()
+ (let ((company-show-numbers 'left)
+ (company-candidates '("x" "y" "z"))
+ (company-format-margin-function (lambda (candidate selected)
+ "X"))
+ (company-candidates-length 3)
+ (company-backend (lambda (c &rest _) (pcase c (`kind 'class)))))
+ (should (equal '(" 1Xx " " 2Xy " " 3Xz ")
+ (cdr (company--create-lines 0 999))))))
+
(ert-deftest company-create-lines-truncates-annotations ()
(let* ((ww (company--window-width))
(data `(("1" . "(123)")