]> git.eshelyaron.com Git - emacs.git/commitdiff
Complete CSS property values less eagerly (Bug#27392)
authorSimen Heggestøyl <simenheg@gmail.com>
Sat, 17 Jun 2017 07:28:43 +0000 (09:28 +0200)
committerSimen Heggestøyl <simenheg@gmail.com>
Sat, 17 Jun 2017 08:38:29 +0000 (10:38 +0200)
* lisp/textmodes/css-mode.el (css--complete-property-value): Be less
eager by looking for a colon after the property which values are being
completed for.

* test/lisp/textmodes/css-mode-tests.el (css-test-complete-property):
Add a test case ensuring that properties that are prefixes of other
properties don't hinder further completion.

lisp/textmodes/css-mode.el
test/lisp/textmodes/css-mode-tests.el

index 0beaaaa32f1778f0fa20c28aacc73f322fb55d5e..4952533e8348d74b6dde863c4a0e36da91994ca7 100644 (file)
@@ -1289,10 +1289,11 @@ the string PROPERTY."
   (let ((property
          (save-excursion
            (re-search-backward ":[^/]" (line-beginning-position) t)
-           (let ((property-end (point)))
-             (skip-chars-backward "-[:alnum:]")
-             (let ((property (buffer-substring (point) property-end)))
-               (car (member property css-property-ids)))))))
+           (when (eq (char-after) ?:)
+             (let ((property-end (point)))
+               (skip-chars-backward "-[:alnum:]")
+               (let ((prop (buffer-substring (point) property-end)))
+                 (car (member prop css-property-ids))))))))
     (when property
       (let ((end (point)))
         (save-excursion
index b4666ae72d74aea58a55c781feb5373a15fdf343..68946a01c06ee1ef6c5c372c79707cc577c3def2 100644 (file)
     (insert "body { f")
     (let ((completions (css-mode-tests--completions)))
       (should (member "filter" completions))
-      (should-not (member "position" completions)))))
+      (should-not (member "position" completions))))
+  ;; Bug#27392
+  (with-temp-buffer
+    (css-mode)
+    (insert "html { grid")
+    (should (> (length (css-mode-tests--completions)) 0))))
 
 (ert-deftest css-test-foreign-completions ()
   (let ((other-buffer-1 (generate-new-buffer "1"))