[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/28: company-fill-propertize: tuncate the common part
From: |
Dmitry Gutov |
Subject: |
[elpa] 01/28: company-fill-propertize: tuncate the common part |
Date: |
Wed, 27 Aug 2014 01:26:17 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 43b05ffa8a72d3bcce763285f8b1f4a907fa4011
Author: Dmitry Gutov <address@hidden>
Date: Mon Jul 28 17:22:14 2014 +0300
company-fill-propertize: tuncate the common part
Fixes #156
---
company-tests.el | 33 +++++++++++++++++++++++++++++++++
company.el | 7 ++++---
2 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/company-tests.el b/company-tests.el
index 005bf3a..fd2a42b 100644
--- a/company-tests.el
+++ b/company-tests.el
@@ -522,6 +522,39 @@
(format " %s " (make-string (- ww 2) ?4)))
(company--create-lines 0 999))))))
+(ert-deftest company-create-lines-truncates-common-part ()
+ (let* ((ww (company--window-width))
+ (company-candidates-length 2)
+ (company-tooltip-margin 1)
+ (company-backend #'ignore))
+ (let* ((company-common (make-string (- ww 3) ?1))
+ (company-candidates `(,(concat company-common "2")
+ ,(concat company-common "3"))))
+ (should (equal (list (format " %s2 " (make-string (- ww 3) ?1))
+ (format " %s3 " (make-string (- ww 3) ?1)))
+ (company--create-lines 0 999))))
+ (let* ((company-common (make-string (- ww 2) ?1))
+ (company-candidates `(,(concat company-common "2")
+ ,(concat company-common "3"))))
+ (should (equal (list (format " %s " company-common)
+ (format " %s " company-common))
+ (company--create-lines 0 999))))
+ (let* ((company-common (make-string ww ?1))
+ (company-candidates `(,(concat company-common "2")
+ ,(concat company-common "3")))
+ (res (company--create-lines 0 999)))
+ (should (equal (list (format " %s " (make-string (- ww 2) ?1))
+ (format " %s " (make-string (- ww 2) ?1)))
+ res))
+ (should (eq 'company-tooltip-common-selection
+ (get-text-property (- ww 2) 'face
+ (car res))))
+ (should (eq 'company-tooltip-selection
+ (get-text-property (1- ww) 'face
+ (car res))))
+
+)))
+
(ert-deftest company-column-with-composition ()
(with-temp-buffer
(insert "lambda ()")
diff --git a/company.el b/company.el
index 7b48347..ac49892 100644
--- a/company.el
+++ b/company.el
@@ -5,7 +5,7 @@
;; Author: Nikolaj Schumacher
;; Maintainer: Dmitry Gutov <address@hidden>
;; URL: http://company-mode.github.io/
-;; Version: 0.8.2
+;; Version: 0.8.3-cvs
;; Keywords: abbrev, convenience, matching
;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
@@ -2110,8 +2110,8 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(defun company-fill-propertize (value annotation width selected left right)
(let* ((margin (length left))
- (common (+ (or (company-call-backend 'match value)
- (length company-common)) margin))
+ (common (or (company-call-backend 'match value)
+ (length company-common)))
(ann-ralign company-tooltip-align-annotations)
(ann-truncate (< width
(+ (length value) (length annotation)
@@ -2135,6 +2135,7 @@ If SHOW-VERSION is non-nil, show the version in the echo
area."
(- width (length
annotation)))
annotation))
right)))
+ (setq common (+ (min common width) margin))
(setq width (+ width margin (length right)))
(add-text-properties 0 width '(face company-tooltip
- [elpa] branch master updated (b6a1a9e -> 2d6cddf), Dmitry Gutov, 2014/08/26
- [elpa] 01/28: company-fill-propertize: tuncate the common part,
Dmitry Gutov <=
- [elpa] 03/28: company-dabbrev-minimum-length: change the initvalue and document better, Dmitry Gutov, 2014/08/26
- [elpa] 06/28: Use `window-body-width' instead of the now-alias `window-width', Dmitry Gutov, 2014/08/26
- [elpa] 07/28: company--window-inner-height: remove, use `window-body-height', Dmitry Gutov, 2014/08/26
- [elpa] 02/28: company-dabbrev--search-buffer: Use `syntax-ppss' to get to the beg of str-or-cmt, Dmitry Gutov, 2014/08/26
- [elpa] 04/28: Remove the "download ERT" logic; should be unused at this point, Dmitry Gutov, 2014/08/26
- [elpa] 08/28: Assign a face for the tooltip search string, Dmitry Gutov, 2014/08/26
- [elpa] 09/28: Merge pull request #164 from holomorph/tooltip-search, Dmitry Gutov, 2014/08/26
- [elpa] 10/28: Mention company-tooltip-search in NEWS, Dmitry Gutov, 2014/08/26
- [elpa] 11/28: Use window-screen-lines when available, Dmitry Gutov, 2014/08/26
- [elpa] 05/28: company--show-inline-p: never ignore case, Dmitry Gutov, 2014/08/26