From 230b8f6f2eb7e603dd3a90f975fd9e98c2ce6e0f Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 22 Jan 2024 13:37:49 +0100 Subject: Ignore 0-length matches when using X// --- src/grab.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/grab.c b/src/grab.c index dbed779..83d3aba 100644 --- a/src/grab.c +++ b/src/grab.c @@ -389,10 +389,13 @@ cmdX(struct sv sv, struct ops ops, size_t i, const char *filename) .p = sv.p + prev.rm_eo, .len = rm.rm_so - prev.rm_eo, }; - if (i + 1 == ops.len) - putf(nsv, nullptr, filename); - else - op_table[(uchar)ops.buf[i + 1].c](nsv, ops, i + 1, filename); + if (nsv.len) { + if (i + 1 == ops.len) + putf(nsv, nullptr, filename); + else + op_table[(uchar)ops.buf[i + 1].c](nsv, ops, i + 1, + filename); + } } prev = rm; -- cgit v1.2.3