aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/xref.el6
-rw-r--r--test/automated/xref-tests.el14
2 files changed, 12 insertions, 8 deletions
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 540c7b0e925..62cef235988 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1016,7 +1016,11 @@ directory, used as the root of the ignore globs."
1016 (syntax-propertize line-end) 1016 (syntax-propertize line-end)
1017 ;; FIXME: This results in several lines with the same 1017 ;; FIXME: This results in several lines with the same
1018 ;; summary. Solve with composite pattern? 1018 ;; summary. Solve with composite pattern?
1019 (while (re-search-forward regexp line-end t) 1019 (while (and
1020 ;; REGEXP might match an empty string. Or line.
1021 (or (null matches)
1022 (> (point) line-beg))
1023 (re-search-forward regexp line-end t))
1020 (let* ((beg-column (- (match-beginning 0) line-beg)) 1024 (let* ((beg-column (- (match-beginning 0) line-beg))
1021 (end-column (- (match-end 0) line-beg)) 1025 (end-column (- (match-end 0) line-beg))
1022 (loc (xref-make-file-location file line beg-column)) 1026 (loc (xref-make-file-location file line beg-column))
diff --git a/test/automated/xref-tests.el b/test/automated/xref-tests.el
index 1b500c3c418..28ca3511c22 100644
--- a/test/automated/xref-tests.el
+++ b/test/automated/xref-tests.el
@@ -28,10 +28,10 @@
28 (should (equal 0 (xref-file-location-column (nth 0 locs)))) 28 (should (equal 0 (xref-file-location-column (nth 0 locs))))
29 (should (equal 4 (xref-file-location-column (nth 1 locs)))))) 29 (should (equal 4 (xref-file-location-column (nth 1 locs))))))
30 30
31;; (ert-deftest xref-collect-matches-finds-an-empty-line-regexp-match () 31(ert-deftest xref-collect-matches-finds-an-empty-line-regexp-match ()
32;; (let* ((matches (xref-collect-matches "^$" "*" xref-tests-data-dir nil)) 32 (let* ((matches (xref-collect-matches "^$" "*" xref-tests-data-dir nil))
33;; (locs (mapcar #'xref-item-location matches))) 33 (locs (mapcar #'xref-item-location matches)))
34;; (should (= 1 (length matches))) 34 (should (= 1 (length matches)))
35;; (should (string-match-p "file2\\.txt\\'" (xref-location-group (nth 0 locs)))) 35 (should (string-match-p "file2\\.txt\\'" (xref-location-group (nth 0 locs))))
36;; (should (equal 1 (xref-location-line (nth 0 locs)))) 36 (should (equal 1 (xref-location-line (nth 0 locs))))
37;; (should (equal 0 (xref-file-location-column (nth 0 locs)))))) 37 (should (equal 0 (xref-file-location-column (nth 0 locs))))))