aboutsummaryrefslogtreecommitdiff
path: root/src/grab.c
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-01-22 13:37:49 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-01-22 13:37:49 +0100
commit230b8f6f2eb7e603dd3a90f975fd9e98c2ce6e0f (patch)
treee023a3b02ea7be98d321513f52ee94fe0931cbe2 /src/grab.c
parent912da4241774194c9cbb4bfca13384b14c5211aa (diff)
Ignore 0-length matches when using X//
Diffstat (limited to 'src/grab.c')
-rw-r--r--src/grab.c11
1 files changed, 7 insertions, 4 deletions
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;