sim

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

commit db616ce8f7959e758d1c433bc4dafa37472d8702
parent 2c8be1d44378919c593eb8d5ef38c4ed0de5bef9
Author: ssnf <ssnf@ssnf.xyz>
Date:   Sat, 21 Aug 2021 17:12:03 +0000

ask for file name if there's none while saving

Diffstat:
Msim.c | 4+---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sim.c b/sim.c @@ -350,8 +350,6 @@ file_close(int arg) if (file[arg].dirty) { printf(CSI "%uH" EL CSI "31mSave %s?" CSI "0m [y/n]", w.wy/2, file[arg].name->s); if (fgetc(stdin) == 'y') { - if (!file[arg].name->n) - input(file[arg].name, "File name: "); file_save(arg); str_zero(f->s); str_zero(f->name); @@ -406,7 +404,7 @@ file_save(int arg) if (arg == -1) arg = f - file; if (!file[arg].name->n) - return; + input(file[arg].name, "File name: "); disk = fopen(file[arg].name->s, "w"); fwrite(file[arg].s->s, file[arg].s->n, 1, disk); fclose(disk);