Skip to content

Commit

Permalink
Adjust to ripgrep new color escapes
Browse files Browse the repository at this point in the history
Changed in BurntSushi/ripgrep@c0c62af
Both old and new scheme should work now.
  • Loading branch information
dajva committed Feb 18, 2018
1 parent 0a4df0c commit 2641353
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions rg.el
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ This function is called from `compilation-filter-hook'."
(setq end (copy-marker end))
;; Add File: in front of filename
(when rg-group-result
(while (re-search-forward "^\033\\[m\033\\[35m\\(.*?\\)\033\\[m$" end 1)
(while (re-search-forward "^\033\\[[0]*m\033\\[35m\\(.*?\\)\033\\[[0]*m$" end 1)
(replace-match (concat (propertize "File:"
'face nil 'font-lock-face 'rg-file-tag-face)
" "
Expand All @@ -467,14 +467,14 @@ This function is called from `compilation-filter-hook'."
(goto-char beg))

;; Highlight rg matches and delete marking sequences.
(while (re-search-forward "\033\\[m\033\\[31m\033\\[1m\\(.*?\\)\033\\[m" end 1)
(while (re-search-forward "\033\\[[0]*m\033\\[31m\033\\[1m\\(.*?\\)\033\\[[0]*m" end 1)
(replace-match (propertize (match-string 1)
'face nil 'font-lock-face 'rg-match-face)
t t)
(setq rg-hit-count (+ rg-hit-count 1)))
;; Delete all remaining escape sequences
(goto-char beg)
(while (re-search-forward "\033\\[[0-9;]*[mK]" end 1)
(while (re-search-forward "\033\\[[0-9;]*[0mK]" end 1)
(replace-match "" t t))))
(run-hooks 'rg-filter-hook)))

Expand Down

0 comments on commit 2641353

Please sign in to comment.