Skip to content

Commit

Permalink
Fix "File: " skipping when building the elements of the imenu
Browse files Browse the repository at this point in the history
We shouldn't be using `skip-chars-forward' here as this function skips
over any _character set_ passed as argument, not just a string.

Without this patch, for instance entries like:

  File: lol/foo.bar

Will be added to the candidates list as "ol/foo.bar" as ?l is in the
character set "File: ".

Instead, just skips 6 chars forward.
  • Loading branch information
nbarrientos committed Oct 24, 2022
1 parent 51596cb commit 0232a43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rg-result.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))))))
Expand Down

0 comments on commit 0232a43

Please sign in to comment.