sim

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

commit a6b5939f5c5806a8211137e8f5ba21cbd8784014
parent e5f164eb8cb1dd73aa3840943abc9928d3a0d4fb
Author: ssnf <ssnf@ssnf.xyz>
Date:   Tue,  4 Feb 2025 23:49:19 +0000

fix status bar dirty file check

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

diff --git a/config.def.h b/config.def.h @@ -1,9 +1,9 @@ -#define STATUS "%lu,%u 0x%02x %s%c -%lu- %u" \ +#define STATUS "%lu,%u 0x%02x %s%s -%lu- %u" \ , f->dot.p1 \ , curpos() \ , f->s.s[f->dot.p1] \ , f->name.n ? f->name.s : "-unnamed-" \ - , ISDIRTY(*f) \ + , (f->di == f->i) ? "" : "*" \ , f - file \ , counter diff --git a/sim.c b/sim.c @@ -9,7 +9,6 @@ #define MAXEMPTY 256 #define FILECOUNT 8 #define LENGTH(a) (sizeof(a)/sizeof(a[0])) -#define ISDIRTY(f) (((f).di == (f).i) ? 0 : '*') #define RED(a) CSI "31m" a CSI "0m" #define GREEN(a) CSI "32m" a CSI "0m" @@ -554,7 +553,7 @@ file_close(int arg) { if (arg != -1) f = &file[arg]; - if (ISDIRTY(*f)) { + if (f->di != f->i) { msg(w.wy / 2, RED("Save %s?") " [y/n]" , f->name.n ? f->name.s : "-unnamed-" );