sim

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

commit 62c1d8a40ede5eb8b33b27c5b488be74ae6ed20a
parent c5ce97645edfcd7ab546ae768a859a2fa6ec5f1c
Author: ssnf <ssnf@ssnf.xyz>
Date:   Sat, 16 Oct 2021 14:45:09 +0000

improved appending on the last file character

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

diff --git a/sim.c b/sim.c @@ -443,12 +443,8 @@ insert(int arg) switch (arg) { case StartLine: case EndLine: - move(arg); - break; case Right: - move(Right); - if (f->dot.p0 >= f->s->n) - str_addc(f->s, '\n'); + move(arg); break; case Down: move(EndLine); @@ -457,6 +453,10 @@ insert(int arg) ++f->dot.p1; break; } + if (f->s->s[f->s->n - 1] != '\n' && f->dot.p0 >= f->s->n) { + str_addc(f->s, '\n'); + move(Right); + } for (;;) { win_query(&w); fr_update();