commit 8086c13d331bac933e84babd4a7d7bdd04cb9b10
parent 93dbb6a6577a99ed8e109d2cebdf8124cb04af0a
Author: ssnf <ssnf@ssnf.xyz>
Date: Mon, 25 Oct 2021 13:00:23 +0000
bug fix
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sim.c b/sim.c
@@ -789,6 +789,7 @@ search(int arg)
Posn pos;
char* p;
+ f->s->s[f->s->n] = 0;
if (arg == '/' || arg == '?') {
str_zero(&srch);
input(&srch, w.wy, "/");
@@ -799,7 +800,7 @@ search(int arg)
if (arg == '/' || arg == 'n') {
move(Right);
p = strstr(f->s->s + f->dot.p0, srch.s);
- if (p == NULL || p - f->s->s > f->s->n) {
+ if (p == NULL) {
move(Left);
return;
}
@@ -814,7 +815,7 @@ search(int arg)
return;
}
}
- if (srch.s[0] == '\n')
+ if (srch.s[0] == '\n' && srch.s[1] != '\n')
move(Right);
p = f->s->s + f->dot.p1;
}