emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 1f836b6 37/66: Merge pull request #810 from joaotavora/mas


From: Dmitry Gutov
Subject: [elpa] master 1f836b6 37/66: Merge pull request #810 from joaotavora/master
Date: Mon, 5 Nov 2018 18:19:18 -0500 (EST)

branch: master
commit 1f836b6b16d313bddef2cccebf49f42d36c58e28
Merge: 24bbc85 d0fab46
Author: Dmitry Gutov <address@hidden>
Commit: GitHub <address@hidden>

    Merge pull request #810 from joaotavora/master
    
    Properly fix #809
---
 company-capf.el    |  2 +-
 test/capf-tests.el | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/company-capf.el b/company-capf.el
index 409687b..343edca 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -133,7 +133,7 @@
                    ((and match-start (not has-face-p))
                     (push (cons match-start pos) chunks)
                     (setq match-start nil))))
-           (if chunks (nreverse chunks) (cons 0 (length arg)))))))
+           (nreverse chunks)))))
     (`duplicates t)
     (`no-cache t)   ;Not much can be done here, as long as we handle
                     ;non-prefix matches.
diff --git a/test/capf-tests.el b/test/capf-tests.el
index b70131c..c8d4202 100644
--- a/test/capf-tests.el
+++ b/test/capf-tests.el
@@ -55,6 +55,30 @@
     (should company-candidates)
     (should (member "with-current-buffer" company-candidates))))
 
+(ert-deftest company-basic-capf-highlighting ()
+  "Test basic `company-capf' support, with basic prefix completion."
+  (company-capf-with-buffer
+    "(with|)"
+    (company-mode)
+    (company-complete)
+    (should company-candidates)
+    (let* ((cand (car (member "with-current-buffer" company-candidates)))
+           (render
+            (and cand
+                 (company-fill-propertize cand nil (length cand) nil nil 
nil))))
+      ;; remove `font-lock-face' and `mouse-face' text properties that aren't
+      ;; relevant to our test
+      (remove-list-of-text-properties
+       0 (length cand) '(font-lock-face mouse-face) render)
+      (should
+       (ert-equal-including-properties
+        render
+        #("with-current-buffer"
+          0 4 (face (company-tooltip-common company-tooltip))   ; "with"
+          4 19 (face (company-tooltip))))))))
+
+
+
 ;; Re. "perfect" highlighting of the non-prefix in company-capf matches, it is
 ;; only working-out-of-the box (i.e. without the `:company-match' meta) in
 ;; recent Emacsen containing the following commit.  The two tests that follow



reply via email to

[Prev in Thread] Current Thread [Next in Thread]