[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 05/14: Fix out-of-bounds error on truncated anno fontification
From: |
Dmitry Gutov |
Subject: |
[elpa] 05/14: Fix out-of-bounds error on truncated anno fontification |
Date: |
Tue, 18 Feb 2014 05:51:01 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 13f971a366c3402aa691443a6b204f1ad3631aab
Author: Dmitry Gutov <address@hidden>
Date: Sun Feb 9 18:32:40 2014 +0200
Fix out-of-bounds error on truncated anno fontification
---
company-tests.el | 16 ++++++++++++++++
company.el | 2 +-
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/company-tests.el b/company-tests.el
index 9272f25..8b56fec 100644
--- a/company-tests.el
+++ b/company-tests.el
@@ -334,6 +334,22 @@
(should (equal '(" x 1 " " y 2 " " z 3 ")
(company--create-lines 0 999)))))
+(ert-deftest company-create-lines-truncates-annotations ()
+ (let* ((ww (company--window-width))
+ (data `(("1" . "(123)")
+ ("2" . nil)
+ ("3" . ,(concat "(" (make-string (- ww 2) ?4) ")"))))
+ (company-candidates (mapcar #'car data))
+ (company-candidates-length 3)
+ (company-tooltip-margin 1)
+ (company-backend (lambda (cmd &optional arg)
+ (when (eq cmd 'annotation)
+ (cdr (assoc arg data))))))
+ (should (equal (list (format " 1(123)%s " (company-space-string (- ww 8)))
+ (format " 2%s " (company-space-string (- ww 3)))
+ (format " 3(444%s " (make-string (- ww 7) ?4)))
+ (company--create-lines 0 999)))))
+
(ert-deftest company-column-with-composition ()
(with-temp-buffer
(insert "lambda ()")
diff --git a/company.el b/company.el
index c67485f..235e8e1 100644
--- a/company.el
+++ b/company.el
@@ -1853,7 +1853,7 @@ Example: \(company-begin-with '\(\"foo\" \"foobar\"
\"foobarbaz\"\)\)"
'(face company-tooltip-common
mouse-face company-tooltip-mouse)
line)
- (add-text-properties ann-start (+ ann-start (length annotation))
+ (add-text-properties ann-start (min (+ ann-start (length annotation))
width)
'(face company-tooltip-annotation
mouse-face company-tooltip-mouse)
line)
- [elpa] branch master updated (2e6b4f6 -> cae1efc), Dmitry Gutov, 2014/02/18
- [elpa] 04/14: Fix scrolling up from the last item, Dmitry Gutov, 2014/02/18
- [elpa] 06/14: Introduce company-dabbrev-downcase, Dmitry Gutov, 2014/02/18
- [elpa] 01/14: Set company-added-newline to t if the buffer was modified, Dmitry Gutov, 2014/02/18
- [elpa] 02/14: Don't `company-cancel' twice, Dmitry Gutov, 2014/02/18
- [elpa] 05/14: Fix out-of-bounds error on truncated anno fontification,
Dmitry Gutov <=
- [elpa] 07/14: company-capf: fix when company-point is nil, Dmitry Gutov, 2014/02/18
- [elpa] 03/14: New user option, company-continue-commands, Dmitry Gutov, 2014/02/18
- [elpa] 08/14: company--capf-data: Check that the cdr is cons, not data itself, Dmitry Gutov, 2014/02/18
- [elpa] 09/14: company-capf common-part: look up font-lock-face, Dmitry Gutov, 2014/02/18
- [elpa] 10/14: company-capf: cache the capf data, Dmitry Gutov, 2014/02/18
- [elpa] 14/14: Merge commit '119822078ee3024c2d27017d45ef4578fa36040f' from company, Dmitry Gutov, 2014/02/18
- [elpa] 12/14: company-continue-commands: change the default value, Dmitry Gutov, 2014/02/18
- [elpa] 13/14: Bump the version, Dmitry Gutov, 2014/02/18
- [elpa] 11/14: common-part: rename to `match' and document, Dmitry Gutov, 2014/02/18