aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/grab.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/grab.c b/src/grab.c
index 13a6e83..56d0442 100644
--- a/src/grab.c
+++ b/src/grab.c
@@ -463,8 +463,10 @@ cmdH(struct sv sv, struct matches *ms, struct ops ops, size_t i,
}
prev = rm;
- if (rm.rm_so == rm.rm_eo)
- rm.rm_eo++;
+ if (rm.rm_so == rm.rm_eo) {
+ rune unused;
+ rm.rm_eo += u8tor_uc(&unused, sv.p + rm.rm_eo);
+ }
rm = (regmatch_t){
.rm_so = rm.rm_eo,
.rm_eo = sv.len,
@@ -554,8 +556,10 @@ cmdX(struct sv sv, struct matches *ms, struct ops ops, size_t i,
}
prev = rm;
- if (rm.rm_so == rm.rm_eo)
- rm.rm_eo++;
+ if (rm.rm_so == rm.rm_eo) {
+ rune unused;
+ rm.rm_eo += u8tor_uc(&unused, sv.p + rm.rm_eo);
+ }
rm = (regmatch_t){
.rm_so = rm.rm_eo,
.rm_eo = sv.len,