[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e692260 15/66: Show numbers in tooltip irrespective of scr
From: |
Dmitry Gutov |
Subject: |
[elpa] master e692260 15/66: Show numbers in tooltip irrespective of scrolling |
Date: |
Tue, 13 Jan 2015 02:44:47 +0000 |
branch: master
commit e692260303544d0cdda75d9734bfe0ce44cc26e9
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Show numbers in tooltip irrespective of scrolling
---
NEWS.md | 2 ++
company.el | 20 +++++++++-----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index a527c04..8494f08 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
## Next
+* `company-show-numbers` and `company-complete-number` now use visual numbering
+ of the candidates, taking into account only the ones currently displayed.
* `company-complete-number` can be bound to keypad numbers directly, with or
without modifiers.
* `company-cmake` supports expansion of `<LANG>` and `<CONFIG>` placeholders
diff --git a/company.el b/company.el
index 3258f16..fcb100e 100644
--- a/company.el
+++ b/company.el
@@ -1857,7 +1857,7 @@ inserted."
(setq this-command 'company-complete-common))))
(defun company-complete-number (n)
- "Insert the Nth candidate.
+ "Insert the Nth candidate visible in the tooltip.
To show the number next to the candidates in some back-ends, enable
`company-show-numbers'. When called interactively, uses the last typed
character, stripping the modifiers. That character must be a digit."
@@ -1871,10 +1871,12 @@ character, stripping the modifiers. That character
must be a digit."
(n (- char ?0)))
(if (zerop n) 10 n))))
(when (company-manual-begin)
- (and (or (< n 1) (> n company-candidates-length))
+ (and (or (< n 1) (> n (- company-candidates-length
+ company-tooltip-offset)))
(error "No candidate number %d" n))
(cl-decf n)
- (company-finish (nth n company-candidates))))
+ (company-finish (nth (+ n company-tooltip-offset)
+ company-candidates))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -2281,7 +2283,6 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(defun company--create-lines (selection limit)
(let ((len company-candidates-length)
- (numbered 99999)
(window-width (company--window-width))
lines
width
@@ -2335,16 +2336,13 @@ If SHOW-VERSION is non-nil, show the version in the
echo area."
(setq width (min window-width
(max company-tooltip-minimum-width
- (if (and company-show-numbers
- (< company-tooltip-offset 10))
+ (if company-show-numbers
(+ 2 width)
width))))
- ;; number can make tooltip too long
- (when company-show-numbers
- (setq numbered company-tooltip-offset))
-
- (let ((items (nreverse items)) new)
+ (let ((items (nreverse items))
+ (numbered (if company-show-numbers 0 99999))
+ new)
(when previous
(push (company--scrollpos-line previous width) new))
- [elpa] master d4088c5 02/66: replace <LANG> <CONFIG> tag in variables, (continued)
- [elpa] master d4088c5 02/66: replace <LANG> <CONFIG> tag in variables, Dmitry Gutov, 2015/01/12
- [elpa] master 250f7af 04/66: s/Fortran/G77, Dmitry Gutov, 2015/01/12
- [elpa] master b6da724 03/66: Clean up a little, Dmitry Gutov, 2015/01/12
- [elpa] master 67ead1a 06/66: Bump the year, Dmitry Gutov, 2015/01/12
- [elpa] master eb03746 09/66: company-cmake--unexpand-candidate: Remove extra underscore, Dmitry Gutov, 2015/01/12
- [elpa] master 28f8dc6 11/66: Update NEWS, Dmitry Gutov, 2015/01/12
- [elpa] master e5627dd 12/66: company-etags-file-table: Check that TAGS is not a directory, Dmitry Gutov, 2015/01/12
- [elpa] master e66f2c3 13/66: company-bbdb: Use the whole line content after `: ' as prefix, Dmitry Gutov, 2015/01/12
- [elpa] master 79d4b0d 10/66: company-cmake: Support G77/Fortran distinction, Dmitry Gutov, 2015/01/12
- [elpa] master 4375685 14/66: company-complete-number: Handle keypad events, Dmitry Gutov, 2015/01/12
- [elpa] master e692260 15/66: Show numbers in tooltip irrespective of scrolling,
Dmitry Gutov <=
- [elpa] master c97666c 18/66: company-files--complete: Ignore case on appropriate systems, Dmitry Gutov, 2015/01/12
- [elpa] master 4d8ac8c 17/66: Support multiple-width chars in annotations, Dmitry Gutov, 2015/01/12
- [elpa] master ea5c4fd 05/66: More cleanup, Dmitry Gutov, 2015/01/12
- [elpa] master b188c49 07/66: Inline company-cmake--find-match, Dmitry Gutov, 2015/01/12
- [elpa] master 556ee69 16/66: Bump the version for development, Dmitry Gutov, 2015/01/12
- [elpa] master ccc08c9 08/66: Eliminate one `setq', Dmitry Gutov, 2015/01/12
- [elpa] master ed86ad5 20/66: company-update-candidates: Fix WRT ignore-case, Dmitry Gutov, 2015/01/12
- [elpa] master abf95f7 19/66: company-update-candidates: Don't be fooled by a few prefix completions, Dmitry Gutov, 2015/01/12
- [elpa] master 98477e7 21/66: Reword comment, Dmitry Gutov, 2015/01/12
- [elpa] master 660cafc 22/66: company-input-noop: Use a symbol for the dummy event binding, Dmitry Gutov, 2015/01/12