branch: externals/company
commit 7f9c857d5b4356abfcd93663d32c204cfc10d78f
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
Fix args-out-of-range in company-preview-show-at-point
Move the handling of company-common's string width from
company--common-or-matches to company-fill-propertize (the renderer should
decide whether to do it with the strings it's working on).
Fixes #1229.
---
company.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/company.el b/company.el
index af657ad..b2bde38 100644
--- a/company.el
+++ b/company.el
@@ -2979,16 +2979,17 @@ If SHOW-VERSION is non-nil, show the version in the
echo area."
(listp matches)
(= 1 (length matches))
(= 0 (caar matches))
- (> (string-width company-common) (cdar matches)))
+ (> (length company-common) (cdar matches)))
(setq matches nil))
(when (integerp matches)
(setq matches `((0 . ,matches))))
(or matches
- (and company-common `((0 . ,(string-width company-common))))
+ (and company-common `((0 . ,(length company-common))))
nil)))
(defun company-fill-propertize (value annotation width selected left right)
(let* ((margin (length left))
+ (company-common (company--clean-string company-common))
(common (company--common-or-matches value))
(_ (setq value (company-reformat (company--pre-render value))
annotation (and annotation (company--pre-render annotation
t))))