diff --git a/rg-result.el b/rg-result.el index 69d1516..f9ec1c8 100644 --- a/rg-result.el +++ b/rg-result.el @@ -777,7 +777,7 @@ previous file with grouped matches." (while (setq nextfile (rg-navigate-file-message nextfile nil 1)) (save-excursion (goto-char nextfile) - (skip-chars-forward "File: ") + (and (looking-at-p "^File: ") (forward-char 6)) (setq filepath (buffer-substring-no-properties (point) (line-end-position)))) (push (cons filepath nextfile) elements)) (nreverse elements)))))) diff --git a/test/data/limenu.el b/test/data/limenu.el new file mode 100644 index 0000000..7213da4 --- /dev/null +++ b/test/data/limenu.el @@ -0,0 +1 @@ +imenu diff --git a/test/rg.el-test.el b/test/rg.el-test.el index 82f6dcb..6f85773 100644 --- a/test/rg.el-test.el +++ b/test/rg.el-test.el @@ -619,6 +619,18 @@ method. " (rg-project-root "/tmp/foo.el")) "/tmp/"))) +(ert-deftest rg-integration-test/imenu-populated () + "Test that the imenu entries are correct." + :tags '(need-rg) + (rg-run "imenu" "elisp" (concat default-directory "test/data")) + (with-current-buffer (rg-buffer-name) + (rg-wait-for-search-result) + (let ((ientries (funcall imenu-create-index-function))) + (should (equal (length ientries) 1)) + (should (equal + '("limenu.el") + (seq-sort #'string-lessp (mapcar #'car ientries))))))) + (ert-deftest rg-integration/command-hiding-hide () "Test command hiding when `rg-hide-command` is non nil." :tags '(need-rg)