(let (this-command)
(company-call 'complete))
(company-call 'open-line 1)
- (should (eq 1 (overlay-start company-pseudo-tooltip-overlay)))))))
+ (should (eq 2 (overlay-start company-pseudo-tooltip-overlay)))))))
(ert-deftest company-pseudo-tooltip-show ()
:tags '(interactive)
(should (eq (overlay-get ov 'company-height) company-tooltip-limit))
(should (eq (overlay-get ov 'company-column) col))
(should (string= (overlay-get ov 'company-display)
- "\n 123 \nc 45 c\nddd\n")))))))
+ " 123 \nc 45 c\nddd\n")))))))
(ert-deftest company-pseudo-tooltip-edit-updates-width ()
:tags '(interactive)
;; With margins.
(should (eq (overlay-get ov 'company-width) 8))
(should (string= (overlay-get ov 'company-display)
- "\n 123(4) \n 45 \n")))))))
+ " 123(4) \n 45 \n")))))))
(ert-deftest company-pseudo-tooltip-show-with-annotations-right-aligned ()
:tags '(interactive)
;; With margins.
(should (eq (overlay-get ov 'company-width) 13))
(should (string= (overlay-get ov 'company-display)
- "\n 123 (4) \n 45 \n 67 (891011) \n")))))))
+ " 123 (4) \n 45 \n 67 (891011) \n")))))))
(ert-deftest company-create-lines-shows-numbers ()
(let ((company-show-numbers t)
" b ︸︸ ")
(company--create-lines 0 999)))))
+(ert-deftest company-create-lines-with-multiple-width-and-keep-prefix ()
+ :tags '(interactive)
+ (let* (company-show-numbers
+ (company-candidates '("MIRAI発売1カ月"
+ "MIRAI発売2カ月"))
+ (company-candidates-length 2)
+ (company-prefix "MIRAI発")
+ (company-backend (lambda (c &optional _arg)
+ (pcase c
+ (`ignore-case 'keep-prefix)))))
+ (should (equal '(" MIRAI発売1カ月 "
+ " MIRAI発売2カ月 ")
+ (company--create-lines 0 999)))))
+
+(ert-deftest company-fill-propertize-truncates-search-highlight ()
+ (let ((company-search-string "foo")
+ (company-backend #'ignore)
+ (company-prefix ""))
+ (should (equal-including-properties
+ (company-fill-propertize "barfoo" nil 6 t nil nil)
+ #("barfoo"
+ 0 3 (face company-tooltip mouse-face company-tooltip-mouse)
+ 3 6 (face company-tooltip-search mouse-face company-tooltip-mouse))))
+ (should (equal-including-properties
+ (company-fill-propertize "barfoo" nil 5 t "" " ")
+ #("barfo "
+ 0 3 (face company-tooltip mouse-face company-tooltip-mouse)
+ 3 5 (face company-tooltip-search mouse-face company-tooltip-mouse)
+ 5 6 (face company-tooltip mouse-face company-tooltip-mouse))))
+ (should (equal-including-properties
+ (company-fill-propertize "barfoo" nil 3 t " " " ")
+ #(" bar "
+ 0 5 (face company-tooltip mouse-face company-tooltip-mouse))))))
+
(ert-deftest company-column-with-composition ()
:tags '(interactive)
(with-temp-buffer
(insert (propertize "a" 'display "bbb\nccc\ndddd\n"))
(insert "eee\nfff\nggg")
(should (equal (company-buffer-lines (point-min) (point-max))
- '("" "" "" "eee" "fff" "ggg")))))
+ '("a" "" "" "eee" "fff" "ggg")))))
(ert-deftest company-buffer-lines-with-multiline-after-string-at-eob ()
:tags '(interactive)
(should (equal (company-buffer-lines (point-min) (point-max))
'("a" "b" "c")))))
+(ert-deftest company-buffer-lines-with-line-wrapping ()
+ :tags '(interactive)
+ (with-temp-buffer
+ (let ((ww (company--window-width)))
+ (insert (make-string (* 3 ww) ?a))
+ (should (equal (company-buffer-lines (point-min) (point-max))
+ (list (make-string ww ?a)
+ (make-string ww ?a)
+ (make-string ww ?a)))))))
+
(ert-deftest company-modify-line ()
(let ((str "-*-foobar"))
(should (equal-including-properties