]> code.delx.au - gnu-emacs-elpa/commitdiff
company--create-lines: Handle keep-prefix with multiple-width chars in prefix
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 16 Jan 2015 01:51:59 +0000 (04:51 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 16 Jan 2015 01:51:59 +0000 (04:51 +0300)
company.el
test/frontends-tests.el

index 965800624cda44995276dcc18b6f28375af68937..005413be27526c633325e3815eb5973e7d70ba06 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: Nikolaj Schumacher
 ;; Maintainer: Dmitry Gutov <dgutov@yandex.ru>
 ;; URL: http://company-mode.github.io/
-;; Version: 0.8.8
+;; Version: 0.8.9-cvs
 ;; Keywords: abbrev, convenience, matching
 ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
 
@@ -2372,7 +2372,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area."
     (dotimes (_ len)
       (let* ((value (pop lines-copy))
              (annotation (company-call-backend 'annotation value)))
-        (setq value (company--clean-string value))
+        (setq value (company--clean-string (company-reformat value)))
         (when annotation
           (when company-tooltip-align-annotations
             ;; `lisp-completion-at-point' adds a space.
@@ -2399,7 +2399,7 @@ If SHOW-VERSION is non-nil, show the version in the echo area."
 
       (dotimes (i len)
         (let* ((item (pop items))
-               (str (company-reformat (car item)))
+               (str (car item))
                (annotation (cdr item))
                (right (company-space-string company-tooltip-margin))
                (width width))
index a10f91461f2c6ef2a4e65640ef97c8a08a8091d7..35c94c95e52e7628198af0d89e5644bb6d68372c 100644 (file)
                      " 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-column-with-composition ()
   :tags '(interactive)
   (with-temp-buffer