branch: externals/consult
commit 449e30394319c4b008a0eb1d61143b917e86f047
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
consult-grep: Preserve empty context lines
---
CHANGELOG.org | 1 +
consult.el | 5 +----
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG.org b/CHANGELOG.org
index 1599da1bb4..b45b9522df 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -7,6 +7,7 @@
- Add ~consult-info-define~ to conveniently define custom ~consult-info-*~
commands
to search through a subset of info manuals.
- ~consult-focus-lines~: Add mode line indicator if active.
+- ~consult-grep~: Preserve empty context lines.
* Version 2.1 (2025-03-11)
diff --git a/consult.el b/consult.el
index 38af589c4b..66414744c4 100644
--- a/consult.el
+++ b/consult.el
@@ -5043,10 +5043,7 @@ BUILDER is the command line builder function."
(let ((file "") (file-len 0) result)
(save-match-data
(dolist (str cands (nreverse result))
- (when (and (string-match consult--grep-match-regexp str)
- ;; Filter out empty context lines
- (or (/= (aref str (match-beginning 3)) ?-)
- (/= (match-end 0) (length str))))
+ (when (string-match consult--grep-match-regexp str)
;; We share the file name across candidates to reduce
;; the amount of allocated memory.
(unless (and (= file-len (- (match-end 1) (match-beginning
1)))