commit 93dbb6a6577a99ed8e109d2cebdf8124cb04af0a
parent c346bdfcb6d755703f12b1a07be115776144963d
Author: ssnf <ssnf@ssnf.xyz>
Date: Mon, 25 Oct 2021 12:45:10 +0000
bug fix
Diffstat:
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -49,6 +49,4 @@ Key keys[] = {
{ 'u', undo },
{ Ctrl + 'r', redo },
{ 'y', yank }
- /*TODO: yank command */
- /*TODO: replace command */
-};
+};
diff --git a/sim.c b/sim.c
@@ -539,10 +539,11 @@ file_load(File* f)
if (!(disk = fopen(f->name->s, "r")))
return;
fseek(disk, 0, SEEK_END);
- f->s->n = ftell(disk);
- str_insure(f->s, f->s->n);
- rewind(disk);
- fread(f->s->s, f->s->n, 1, disk);
+ if ((f->s->n = ftell(disk))) {
+ str_insure(f->s, f->s->n);
+ rewind(disk);
+ fread(f->s->s, f->s->n, 1, disk);
+ }
fclose(disk);
f->dot.p0 = f->dot.p1 = 0;
f->i = -1;