From 67a96dbbfe645b64291ed62eab6f1eb391a834e0 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 14 Jan 2014 15:20:59 +0200 Subject: [PATCH] Fix a broken test, remove a duplicate one --- company-tests.el | 18 ++---------------- company.el | 14 +++++++------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/company-tests.el b/company-tests.el index b111822bb..e9116b21b 100644 --- a/company-tests.el +++ b/company-tests.el @@ -166,6 +166,7 @@ (with-temp-buffer (company-mode) (let (company-frontends + company-end-of-buffer-workaround (company-backends (list (lambda (command &optional arg) (case command @@ -177,7 +178,7 @@ (company-complete)) (should (string= "ab" (buffer-string))) (delete-char -2) - (insert "AB") ; hack, to keep it in one test + (insert "A") ; hack, to keep it in one test (company-complete-selection) (should (string= "abcd" (buffer-string)))))) @@ -197,21 +198,6 @@ (company-complete-selection) (should (string= "ABcd" (buffer-string)))))) -(ert-deftest company-non-prefix-completion () - (with-temp-buffer - (insert "tc") - (company-mode) - (let (company-frontends - company-end-of-buffer-workaround - (company-backends - (list (lambda (command &optional arg) - (case command - (prefix (buffer-substring (point-min) (point))) - (candidates '("tea-cup" "teal-color"))))))) - (let (this-command) - (company-complete)) - (should (string= "tc" (buffer-string)))))) - (ert-deftest company-non-prefix-completion () (with-temp-buffer (insert "tc") diff --git a/company.el b/company.el index 1015415c6..1a324c723 100644 --- a/company.el +++ b/company.el @@ -828,13 +828,13 @@ can retrieve meta-data for them." ;; Save in cache: (push (cons company-prefix company-candidates) company-candidates-cache) ;; Calculate common. - (let ((completion-ignore-case (company-call-backend 'ignore-case)) - ;; We want to support non-prefix completion, so filtering is the - ;; responsibility of each respective backend, not ours. - ;; On the other hand, we don't want to replace non-prefix input in - ;; `company-complete-common'. - (common (try-completion company-prefix company-candidates))) - (setq company-common (company--safe-candidate common)))) + (let ((completion-ignore-case (company-call-backend 'ignore-case))) + ;; We want to support non-prefix completion, so filtering is the + ;; responsibility of each respective backend, not ours. + ;; On the other hand, we don't want to replace non-prefix input in + ;; `company-complete-common'. + (setq company-common (company--safe-candidate + (try-completion company-prefix company-candidates))))) (defun company--safe-candidate (str) (or (company-call-backend 'crop str) -- 2.39.2