--- /dev/null
+From b1e0ba5b8325860ac5fc6866f1982d62bedb9437 Mon Sep 17 00:00:00 2001
+From: Jan Palus <atler@pld-linux.org>
+Date: Tue, 24 Nov 2020 12:36:18 +0100
+Subject: [PATCH] Fix highlighting of multiple matches in same line with
+ --nomultiline
+
+offset_vector values are absolute within line so no need to recalculate
+them relative to previous match, just add buf_offset (beginning of line)
+
+Fixes #1080
+---
+ src/search.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/src/search.c b/src/search.c
+index 0dad3c07..ad48b9bb 100644
+--- a/src/search.c
++++ b/src/search.c
+@@ -147,7 +147,6 @@ ssize_t search_buf(const char *buf, const size_t buf_len,
+ if (rv < 0) {
+ break;
+ }
+- size_t line_to_buf = buf_offset + line_offset;
+ log_debug("Regex match found. File %s, offset %i bytes.", dir_full_path, offset_vector[0]);
+ line_offset = offset_vector[1];
+ if (offset_vector[0] == offset_vector[1]) {
+@@ -157,8 +156,8 @@ ssize_t search_buf(const char *buf, const size_t buf_len,
+
+ realloc_matches(&matches, &matches_size, matches_len + matches_spare);
+
+- matches[matches_len].start = offset_vector[0] + line_to_buf;
+- matches[matches_len].end = offset_vector[1] + line_to_buf;
++ matches[matches_len].start = offset_vector[0] + buf_offset;
++ matches[matches_len].end = offset_vector[1] + buf_offset;
+ matches_len++;
+
+ if (opts.max_matches_per_file > 0 && matches_len >= opts.max_matches_per_file) {
Summary: A code-searching tool similar to ack, but faster
Name: the_silver_searcher
Version: 2.2.0
-Release: 1
+Release: 2
License: Appache v2.0
Group: Applications
Source0: https://geoff.greer.fm/ag/releases/%{name}-%{version}.tar.gz
# Source0-md5: 958a614cbebf47b2f27a7d00a5bb1bcb
-URL: https://geoff.greer.fm/ag/
Patch0: gcc10.patch
+Patch1: hl_multi_matches_nomultiline.patch
+URL: https://geoff.greer.fm/ag/
BuildRequires: autoconf >= 2.59
BuildRequires: automake
BuildRequires: pcre-devel
%prep
%setup -q
%patch0 -p1
+%patch1 -p1
%build
%{__aclocal} -I m4