"avatar"))
(company-candidates-length 2)
(company-backend 'ignore))
- (should (equal '(" avalis‗e "
- " avatar ")
+ (should (equal '(" avalis‗e "
+ " avatar ")
(company--create-lines 0 999)))))
(ert-deftest company-create-lines-handles-multiple-width ()
" 蛙abc ")
(company--create-lines 0 999)))))
+(ert-deftest company-create-lines-handles-multiple-width-in-annotation ()
+ (let* (company-show-numbers
+ (alist '(("a" . " ︸") ("b" . " ︸︸")))
+ (company-candidates (mapcar #'car alist))
+ (company-candidates-length 2)
+ (company-backend (lambda (c &optional a)
+ (when (eq c 'annotation)
+ (assoc-default a alist)))))
+ (should (equal '(" a ︸ "
+ " b ︸︸ ")
+ (company--create-lines 0 999)))))
+
(ert-deftest company-column-with-composition ()
:tags '(interactive)
(with-temp-buffer
(string-width company-common)
0)))
(ann-ralign company-tooltip-align-annotations)
- (value (company--clean-string value))
(ann-truncate (< width
(+ (length value) (length annotation)
(if ann-ralign 1 0))))
(dotimes (_ len)
(let* ((value (pop lines-copy))
(annotation (company-call-backend 'annotation value)))
- (when (and annotation company-tooltip-align-annotations)
- ;; `lisp-completion-at-point' adds a space.
- (setq annotation (comment-string-strip annotation t nil)))
+ (setq value (company--clean-string value))
+ (when annotation
+ (when company-tooltip-align-annotations
+ ;; `lisp-completion-at-point' adds a space.
+ (setq annotation (comment-string-strip annotation t nil)))
+ (setq annotation (company--clean-string annotation)))
(push (cons value annotation) items)
- (setq width (max (+ (string-width value)
+ (setq width (max (+ (length value)
(if (and annotation company-tooltip-align-annotations)
(1+ (length annotation))
(length annotation)))