sim

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

commit c5ce97645edfcd7ab546ae768a859a2fa6ec5f1c
parent 5b23e1106d00ba4af0764c023a42816cb36165ab
Author: ssnf <ssnf@ssnf.xyz>
Date:   Fri, 15 Oct 2021 19:51:27 +0000

bug fixes

Diffstat:
MMakefile | 2+-
Mconfig.def.h | 2+-
Msim.c | 15+++++++--------
3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,5 +1,5 @@ CC = c89 -CFLAGS = -Os -Wall -Wpedantic -Wno-deprecated-declarations -Wno-return-type +CFLAGS = -Os -g -Wall -Wpedantic -Wno-deprecated-declarations -Wno-return-type SRC = ${wildcard *.c} OBJ = ${SRC:.c=.o} diff --git a/config.def.h b/config.def.h @@ -15,7 +15,7 @@ Key keys[] = { { '8', count, 8 }, { '9', count, 9 }, { 'd', delete }, - { 'd', delete , Line }, + { 'D', delete, '\n' + 0x7f }, { 'x', delete , Letter }, { '.', dot }, { Esc, escape }, diff --git a/sim.c b/sim.c @@ -358,7 +358,7 @@ dot(int arg) } if (buf->is[f->i].n) str_insert(f->s, &buf->is[f->i], f->dot.p0); - buf_add(buf, buf->is, &ds, Change, arg, buf->count[f->i], f->dot.p0); + buf_add(buf, &buf->is[f->i], &ds, Change, arg, buf->count[f->i], f->dot.p0); str_close(&ds); f->dot.p1 = f->dot.p0; break; @@ -514,13 +514,12 @@ file_close(int arg) arg = f - file; if (file[arg].dirty) { printf(CSI "%uH" EL CSI "31mSave %s?" CSI "0m [y/n]", w.wy/2, file[arg].name->n ? file[arg].name->s : "-unnamed-"); - if (fgetc(stdin) == 'y') { + if (fgetc(stdin) == 'y') file_save(arg); - str_zero(f->s); - str_zero(f->name); - f->dot.p0 = f->dot.p1 = 0; - } } + str_zero(f->s); + str_zero(f->name); + f->dot.p0 = f->dot.p1 = 0; } static void @@ -827,13 +826,13 @@ select(int arg) { Posn p0; + if (!counter) + ++counter; if (arg > 0x7f) { arg -= 0x7f; goto till; } p0 = f->dot.p1 = f->dot.p0; - if (!counter) - ++counter; switch (arg) { case Letter: p0 = f->dot.p0;