[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 37/52: company-pseudo-tooltip-edit: update company-width
From: |
Dmitry Gutov |
Subject: |
[elpa] 37/52: company-pseudo-tooltip-edit: update company-width |
Date: |
Tue, 01 Jul 2014 11:53:26 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit 8af882a94821787ccca987d926c7d26e7b2870e0
Author: Dmitry Gutov <address@hidden>
Date: Fri Jun 13 18:50:27 2014 +0300
company-pseudo-tooltip-edit: update company-width
#138
---
company-tests.el | 18 ++++++++++++++++++
company.el | 7 +++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/company-tests.el b/company-tests.el
index c4e4668..ea77b61 100644
--- a/company-tests.el
+++ b/company-tests.el
@@ -392,6 +392,24 @@
(should (string= (overlay-get ov 'company-after)
" 123 \nc 45 c\nddd\n")))))))
+(ert-deftest company-pseudo-tooltip-edit-updates-width ()
+ :tags '(interactive)
+ (with-temp-buffer
+ (set-window-buffer nil (current-buffer))
+ (let ((company-candidates-length 5)
+ (company-candidates '("123" "45" "67" "89" "1011"))
+ (company-backend 'ignore)
+ (company-tooltip-limit 4)
+ (company-tooltip-offset-display 'scrollbar))
+ (company-pseudo-tooltip-show (company--row)
+ (company--column)
+ 0)
+ (should (eq (overlay-get company-pseudo-tooltip-overlay 'company-width)
+ 6))
+ (company-pseudo-tooltip-edit 4)
+ (should (eq (overlay-get company-pseudo-tooltip-overlay 'company-width)
+ 7)))))
+
(ert-deftest company-preview-show-with-annotations ()
:tags '(interactive)
(with-temp-buffer
diff --git a/company.el b/company.el
index 3e34519..c810100 100644
--- a/company.el
+++ b/company.el
@@ -2340,10 +2340,13 @@ Returns a negative number if the tooltip should be
displayed above point."
(company-pseudo-tooltip-show (1+ row) col company-selection)))
(defun company-pseudo-tooltip-edit (selection)
- (let ((height (overlay-get company-pseudo-tooltip-overlay 'company-height)))
+ (let* ((height (overlay-get company-pseudo-tooltip-overlay 'company-height))
+ (lines (company--create-lines selection (abs height))))
+ (overlay-put company-pseudo-tooltip-overlay 'company-width
+ (string-width (car lines)))
(overlay-put company-pseudo-tooltip-overlay 'company-after
(apply 'company--replacement-string
- (company--create-lines selection (abs height))
+ lines
(overlay-get company-pseudo-tooltip-overlay
'company-replacement-args)))))
- [elpa] 28/52: Add package-version property to vars after in 0.7.0, (continued)
- [elpa] 28/52: Add package-version property to vars after in 0.7.0, Dmitry Gutov, 2014/07/01
- [elpa] 29/52: Bind company-show-doc-buffer to C-h, Dmitry Gutov, 2014/07/01
- [elpa] 31/52: company-css-value-classes: fix border-width infloop, Dmitry Gutov, 2014/07/01
- [elpa] 32/52: company-css-property-values: port to lexical-binding, Dmitry Gutov, 2014/07/01
- [elpa] 33/52: company-css: add a bunch of CSS3 properties, Dmitry Gutov, 2014/07/01
- [elpa] 36/52: company-css-property-alist: remove reference to font-variant in value for font, Dmitry Gutov, 2014/07/01
- [elpa] 34/52: company-gtags: add arguments insertion, Dmitry Gutov, 2014/07/01
- [elpa] 38/52: Indicate current candidate's backend when it's in a group, Dmitry Gutov, 2014/07/01
- [elpa] 39/52: company-update-group-lighter: privatize, Dmitry Gutov, 2014/07/01
- [elpa] 41/52: Improve comment wording, Dmitry Gutov, 2014/07/01
- [elpa] 37/52: company-pseudo-tooltip-edit: update company-width,
Dmitry Gutov <=
- [elpa] 44/52: company-keywords-alist: ass js-mode -> javascript-mode alias, Dmitry Gutov, 2014/07/01
- [elpa] 43/52: company--should-idle-begin: use a more careful check, Dmitry Gutov, 2014/07/01
- [elpa] 42/52: Don't assign to company-point in company-abort and company-finish, Dmitry Gutov, 2014/07/01
- [elpa] 46/52: Never delete the "added newline" twice, Dmitry Gutov, 2014/07/01
- [elpa] 47/52: Don't call post-completion methods and hook in continue-failed case, Dmitry Gutov, 2014/07/01
- [elpa] 45/52: Bring back this-command check when company-idle-delay is t, Dmitry Gutov, 2014/07/01
- [elpa] 40/52: Define company-sort-by-backend-importance, Dmitry Gutov, 2014/07/01
- [elpa] 49/52: company-backends: add better introduction, Dmitry Gutov, 2014/07/01
- [elpa] 48/52: Avoid requiring match is certain circumstances, Dmitry Gutov, 2014/07/01
- [elpa] 35/52: company-css: Add HTML5 tags and more CSS3 properties, Dmitry Gutov, 2014/07/01