[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master d5f3a95 29/40: add option to show number on the left
From: |
Dmitry Gutov |
Subject: |
[elpa] master d5f3a95 29/40: add option to show number on the left |
Date: |
Thu, 2 Jan 2020 18:57:04 -0500 (EST) |
branch: master
commit d5f3a95b4b575f29610cc2cb01d941bd60920796
Author: Amos Bird <address@hidden>
Commit: Amos Bird <address@hidden>
add option to show number on the left
---
NEWS.md | 1 +
company.el | 14 +++++++++-----
test/frontends-tests.el | 8 ++++++++
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index a551f13..9e99c00 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -13,6 +13,7 @@
map binding `TAB` to "jump to the next field"). Affects both
`company-template` and `yasnippet` (requires changes from 2019-04-21,
currently unreleased).
+* New values for option `company-show-numbers` to show number on the left.
## 2019-04-15 (0.9.10)
diff --git a/company.el b/company.el
index 82223fb..d90f241 100644
--- a/company.el
+++ b/company.el
@@ -641,7 +641,8 @@ commands in the `company-' namespace, abort completion."
(defcustom company-show-numbers nil
"If enabled, show quick-access numbers for the first ten candidates."
:type '(choice (const :tag "off" nil)
- (const :tag "on" t)))
+ (const :tag "left" 'left)
+ (const :tag "on" 't)))
(defcustom company-show-numbers-function #'company--show-numbers
"Function called to get custom quick-access numbers for the first then
candidates.
@@ -2818,17 +2819,20 @@ If SHOW-VERSION is non-nil, show the version in the
echo area."
(let* ((item (pop items))
(str (car item))
(annotation (cdr item))
- (right (company-space-string company-tooltip-margin))
+ (margin (company-space-string company-tooltip-margin))
+ (left margin)
+ (right margin)
(width width))
(when (< numbered 10)
(cl-decf width 2)
(cl-incf numbered)
- (setq right (concat (funcall company-show-numbers-function
numbered) right)))
+ (setf (if (eq company-show-numbers 'left) left right)
+ (concat (funcall company-show-numbers-function numbered)
+ margin)))
(push (concat
(company-fill-propertize str annotation
width (equal i selection)
- (company-space-string
- company-tooltip-margin)
+ left
right)
(when scrollbar-bounds
(company--scrollbar i scrollbar-bounds)))
diff --git a/test/frontends-tests.el b/test/frontends-tests.el
index 7212c3f..f7f578e 100644
--- a/test/frontends-tests.el
+++ b/test/frontends-tests.el
@@ -139,6 +139,14 @@
(should (equal '(" x 1 " " y 2 " " z 3 ")
(company--create-lines 0 999)))))
+(ert-deftest company-create-lines-shows-numbers-on-the-left ()
+ (let ((company-show-numbers 'left)
+ (company-candidates '("x" "y" "z"))
+ (company-candidates-length 3)
+ (company-backend 'ignore))
+ (should (equal '(" 1 x " " 2 y " " 3 z ")
+ (company--create-lines 0 999)))))
+
(ert-deftest company-create-lines-truncates-annotations ()
(let* ((ww (company--window-width))
(data `(("1" . "(123)")
- [elpa] master d943198 15/40: Add some clarification for the require-match 'never return value, (continued)
- [elpa] master d943198 15/40: Add some clarification for the require-match 'never return value, Dmitry Gutov, 2020/01/02
- [elpa] master 67b6041 17/40: Merge pull request #934 from DamienCassou/typos, Dmitry Gutov, 2020/01/02
- [elpa] master 027d180 22/40: company--perform: Clarify the control flow a little bit, Dmitry Gutov, 2020/01/02
- [elpa] master 7287fa7 28/40: company-show-numbers-function: Improve the docstring, Dmitry Gutov, 2020/01/02
- [elpa] master 14f80ed 27/40: Move face definitions to a separate group, Dmitry Gutov, 2020/01/02
- [elpa] master 74b75eb 31/40: company-gtags--fetch-tags: Allow exit status 1, Dmitry Gutov, 2020/01/02
- [elpa] master 87c35d8 26/40: End group name with period, Dmitry Gutov, 2020/01/02
- [elpa] master a8d5d6f 24/40: company-files: Recognize file names right after [, Dmitry Gutov, 2020/01/02
- [elpa] master cf2d50b 25/40: Change the overlay's "underlying face" in a better way, Dmitry Gutov, 2020/01/02
- [elpa] master 335eb42 30/40: Fix case when "underlying face" is from Flymake or Flycheck, Dmitry Gutov, 2020/01/02
- [elpa] master d5f3a95 29/40: add option to show number on the left,
Dmitry Gutov <=
- [elpa] master 856c66a 32/40: company-gtags--annotation: Use regexp-quote, Dmitry Gutov, 2020/01/02
- [elpa] master c046847 33/40: Add a NEWS entry, Dmitry Gutov, 2020/01/02
- [elpa] master f3e0290 14/40: Merge branch 'master' of github.com:company-mode/company-mode, Dmitry Gutov, 2020/01/02
- [elpa] master b800fbd 23/40: company-enable-overriding-keymap: Make a defun, Dmitry Gutov, 2020/01/02
- [elpa] master 7fc6ad9 34/40: Merge pull request #941 from amosbird/master, Dmitry Gutov, 2020/01/02
- [elpa] master 0760e48 37/40: Move the entry to the proper position, Dmitry Gutov, 2020/01/02
- [elpa] master dbb4c74 35/40: Merge branch 'master' of github.com:company-mode/company-mode, Dmitry Gutov, 2020/01/02
- [elpa] master 1b00f8c 38/40: Update copyright notice, Dmitry Gutov, 2020/01/02
- [elpa] master ed14c67 40/40: Merge commit '3c11c30c9ab41d8a9c88560071c48fbcdcbcba5d' from company, Dmitry Gutov, 2020/01/02
- [elpa] master 3c11c30 39/40: Bump the version, Dmitry Gutov, 2020/01/02