dajva / rg.el

Emacs search tool based on ripgrep
https://rgel.readthedocs.io
GNU General Public License v3.0
471 stars 38 forks source link

Incorrect number of matches when matches span multiple lines #120

Closed mattbeshara closed 3 years ago

mattbeshara commented 3 years ago

When using -U, it seems that the number of matches reported is really the number of lines matched in total. This bug can be observed when searching for defun[^\n]+\n[^\n]+t\) in rg-autoloads.el. Sample output follows:

File: rg-autoloads.el
  99  56 (function-put 'rg-define-search 'lisp-indent-function 'defun)
 100  56  (autoload 'rg-project "rg.el" "" t)

rg finished (2 matches found) at Sun Jun 20 20:56:32
dajva commented 3 years ago

This is kind of expected since multi line support has not been considered in this package. Not much to do about this with the current implementation. The match count is based on the colors that ripgrep emits around matches that doesn't span multiple lines. I have experimented with the ripgrep json output for this package which would presumably solve this. It's significantly slower though due to the json parsning needed, so I have not switched to that.

So for know I consider this a "known issue".