commit 2649fa79c1e66cd825a952501df9acb8af66ca25
parent 585ce525dc4dedc92fb7c9cd4a8f36d3d9ac721f
Author: ssnf <ssnf@ssnf.xyz>
Date: Tue, 24 May 2022 14:08:53 +0000
Fixed reverse search when first character is '\n'. Improved Makefile
Diffstat:
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -8,7 +8,7 @@ all: sim
config.h:
cp config.def.h $@
-${OBJ}: config.h
+${OBJ}: config.h sim.h
sim: ${OBJ}
${CC} ${OBJ} -o $@
diff --git a/sim.c b/sim.c
@@ -874,6 +874,8 @@ search(int arg)
}
} else {
pos = f->dot.p1;
+ if (srch.s[0] == '\n' && srch.s[1] != '\n')
+ move(Left);
for (;;) {
for (;move(Left), f->dot.p1 && f->s->s[f->dot.p1] != srch.s[0];);
if (!strncmp(f->s->s + f->dot.p1, srch.s, srch.n))