sim

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

commit c69bd6a6e243c9d2f791800e836a07ac652579e6
parent 4aded4c51538b9e66fd23f5a29a80b04b7d223d4
Author: ssnf <ssnf@ssnf.xyz>
Date:   Sat, 21 Aug 2021 19:33:22 +0000

improved file status

Diffstat:
Mconfig.def.h | 5++++-
Msim.c | 5+++--
2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -1,3 +1,5 @@ +#define STATUS "0x%02x -%lu- %s%c", f->s->s[f->dot.p1], f - file, f->name->n ? f->name->s : "-unnamed-", f->dirty + Key keys[] = { { 'h', move, Left }, { 'j', move, Down }, @@ -22,7 +24,8 @@ Key keys[] = { { 'x', delete , 1 }, { 'E', file_open }, { 'q', file_close, -1 }, - { 's', file_save, -1 }, + { 'S', file_save, -1 }, { 'Q', quit }, { Esc, escape } }; + diff --git a/sim.c b/sim.c @@ -367,7 +367,7 @@ file_close(int arg) if (arg == -1) arg = f - file; if (file[arg].dirty) { - printf(CSI "%uH" EL CSI "31mSave %s?" CSI "0m [y/n]", w.wy/2, file[arg].name->s); + 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') { file_save(arg); str_zero(f->s); @@ -515,7 +515,8 @@ fr_update(int arg) goto full_update; } status: - printf(CSI "%uH" "%lu;%lu;%lu 0x%02x -%lu- %s%c", w.wy, f->s->n, f->dot.p0, f->dot.p1, f->s->s[f->dot.p1], f - file, f->name->s, f->dirty); + printf(CSI "%uH", w.wy); + printf(STATUS); for (p0 = fr->a[fr->dot].p0, p1 = 1; p0 < f->dot.p1; ++p0) { if (f->s->s[p0] == '\t' && p1 % 4) { p1 += 5 - (p1 % 4);