[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7fc6ad9 34/40: Merge pull request #941 from amosbird/maste
From: |
Dmitry Gutov |
Subject: |
[elpa] master 7fc6ad9 34/40: Merge pull request #941 from amosbird/master |
Date: |
Thu, 2 Jan 2020 18:57:05 -0500 (EST) |
branch: master
commit 7fc6ad9300a7bb2666def38537acd5ddcad49323
Merge: 856c66a d5f3a95
Author: Dmitry Gutov <address@hidden>
Commit: GitHub <address@hidden>
Merge pull request #941 from amosbird/master
add option to show numbers 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 1ee7d4d..dedaa30 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 quick-access numbers for the first ten candidates.
@@ -2817,17 +2818,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 74b75eb 31/40: company-gtags--fetch-tags: Allow exit status 1, (continued)
- [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, 2020/01/02
- [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 <=
- [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
- [elpa] master bb737d8 20/40: Determine exit-function's status using completion-boundaries, Dmitry Gutov, 2020/01/02
- [elpa] master 74bb693 21/40: Call Clang from the directory containing compile_flags.txt, Dmitry Gutov, 2020/01/02
- [elpa] master 7f3ae90 19/40: Add option company-clang-use-compile-flags-txt, Dmitry Gutov, 2020/01/02
- [elpa] master da4da70 36/40: Edit NEWS, Dmitry Gutov, 2020/01/02