sim

the sim text editor
git clone git://ssnf.xyz/sim
Log | Files | Refs | README

commit df5c78f6b27ce85cd3856f164aa4bbfccbc306aa
parent e8be9d7cf05ef913b1aec785e184e3dc26dff0e3
Author: ssnf <ssnf@ssnf.xyz>
Date:   Wed, 18 May 2022 23:20:12 +0000

Improved fr_calc() behavior, fixed garbage characters on long input() strings

Diffstat:
Msim.c | 11++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sim.c b/sim.c @@ -599,12 +599,12 @@ fr_calc(Frame* fr) ushort half; half = w.wy >> 1; - if (!fr->n || f->dot.p1 < fr->a[fr->dot].p0 + if (!fr->n + || f->dot.p1 != f->dot.p0 + || f->dot.p1 < fr->a[0].p0 || f->dot.p1 > fr->a[fr->n ? fr->n - 1 : 0].p1 - || (((fr->dot < half && fr->a[0].p0 && (fr->n > w.wy * 3)) - || (fr->dot + half + 1 > fr->n)) - && (fr->a[fr->n ? fr->n - 1 : 0].p1 != f->s->n) - ) + || (fr->dot < half && fr->a[0].p0 && fr->n < w.wy * 3) + || (fr->dot + half + 1 > fr->n && fr->a[fr->n ? fr->n - 1 : 0].p1 + 1 != f->s->n) ) { fr_zero(fr); for (p0 = f->dot.p1; p0; --p0) @@ -990,6 +990,7 @@ str_addc(String* p, int c) { str_insure(p, p->n + 1); p->s[p->n++] = c; + p->s[p->n] = '\0'; } static void