branch: master commit c7f675e016968265d24265c0d7c8662f20b0f2bb Merge: ca6142f a4ac0de Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
Merge commit 'a4ac0dead8e9cb440c1f8aec9141d6c64bad4933' from company --- packages/company/NEWS.md | 5 +++++ packages/company/company-ispell.el | 13 ++++++++++--- packages/company/company.el | 22 +++++++++++++++++++--- packages/company/test/frontends-tests.el | 14 ++++++++++++++ 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/packages/company/NEWS.md b/packages/company/NEWS.md index 70d6a0f..4139186 100644 --- a/packages/company/NEWS.md +++ b/packages/company/NEWS.md @@ -1,5 +1,10 @@ # History of user-visible changes +## 2015-01-23 (0.8.9) + +* New commands `company-next-page` and `company-previous-page`, remapping + `scroll-up-command` and `scroll-down-command` during completion. + ## 2015-01-13 (0.8.8) * Pressing `M-n` or `M-p` doesn't quit the search mode. diff --git a/packages/company/company-ispell.el b/packages/company/company-ispell.el index 1561bee..4ce8dfc 100644 --- a/packages/company/company-ispell.el +++ b/packages/company/company-ispell.el @@ -1,6 +1,6 @@ ;;; company-ispell.el --- company-mode completion back-end using Ispell -;; Copyright (C) 2009-2011 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011, 2013-2015 Free Software Foundation, Inc. ;; Author: Nikolaj Schumacher @@ -60,8 +60,15 @@ If nil, use `ispell-complete-word-dict'." (interactive (company-begin-backend 'company-ispell)) (prefix (when (company-ispell-available) (company-grab-word))) - (candidates (lookup-words arg (or company-ispell-dictionary - ispell-complete-word-dict))) + (candidates + (let ((words (lookup-words arg (or company-ispell-dictionary + ispell-complete-word-dict))) + (completion-ignore-case t)) + (if (string= arg "") + ;; Small optimization. + words + ;; Work around issue #284. + (all-completions arg words)))) (sorted t) (ignore-case 'keep-prefix))) diff --git a/packages/company/company.el b/packages/company/company.el index 9658006..4c7e160 100644 --- a/packages/company/company.el +++ b/packages/company/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 ;; Keywords: abbrev, convenience, matching ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5")) @@ -614,6 +614,8 @@ asynchronous call into synchronous.") (define-key keymap (kbd "M-p") 'company-select-previous) (define-key keymap (kbd "<down>") 'company-select-next-or-abort) (define-key keymap (kbd "<up>") 'company-select-previous-or-abort) + (define-key keymap [remap scroll-up-command] 'company-next-page) + (define-key keymap [remap scroll-down-command] 'company-previous-page) (define-key keymap [down-mouse-1] 'ignore) (define-key keymap [down-mouse-3] 'ignore) (define-key keymap [mouse-1] 'company-complete-mouse) @@ -1811,6 +1813,20 @@ and invoke the normal binding." (company-abort) (company--unread-last-input))) +(defun company-next-page () + "Select the candidate one page further." + (interactive) + (when (company-manual-begin) + (company-set-selection (+ company-selection + company-tooltip-limit)))) + +(defun company-previous-page () + "Select the candidate one page earlier." + (interactive) + (when (company-manual-begin) + (company-set-selection (- company-selection + company-tooltip-limit)))) + (defvar company-pseudo-tooltip-overlay) (defvar company-tooltip-offset) @@ -2372,7 +2388,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 +2415,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/packages/company/test/frontends-tests.el b/packages/company/test/frontends-tests.el index a10f914..35c94c9 100644 --- a/packages/company/test/frontends-tests.el +++ b/packages/company/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