branch: master commit 75f578ee635b1f61246569cbef0e466be1dba803 Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
company--create-lines: Handle keep-prefix with multiple-width chars in prefix --- company.el | 6 +++--- test/frontends-tests.el | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/company.el b/company.el index 9658006..005413b 100644 --- a/company.el +++ b/company.el @@ -5,7 +5,7 @@ ;; Author: Nikolaj Schumacher ;; Maintainer: Dmitry Gutov <dgu...@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)) diff --git a/test/frontends-tests.el b/test/frontends-tests.el index a10f914..35c94c9 100644 --- a/test/frontends-tests.el +++ b/test/frontends-tests.el @@ -231,6 +231,20 @@ " 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