From ad0b403caa61c3f1c07698ffe6952588861d98c2 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sat, 20 Jul 2019 10:49:14 +0100 Subject: small changes to status bar + remove trailing blanks --- gramscii.c | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/gramscii.c b/gramscii.c index fb2efa4..ce97462 100644 --- a/gramscii.c +++ b/gramscii.c @@ -106,18 +106,21 @@ char* state_str(){ default: return "ERR"; } - return "ERR"; + return "ERR"; } void status_bar(){ - + printf("\033[%d;1f\033[7m", HEIGHT+1); printf("%100s", " "); printf("\033[%d;1f\033[7m", HEIGHT+1); - printf(" x: %3d y: %3d -- mode: %4s hl: %c vl: %c cn: %c <: %c >: %c %10s", + printf(" x:%3d y:%3d -- MODE:%4s HL:%c VL:%c CN:%c SM:%c EM:%c %10s", x, y, state_str(), line_h, line_v, corner, mark_st, mark_end, ""); - printf(" [%s]", fname ); + if (!modified) + printf(" [%s]", fname ); + else + printf(" *%s*", fname ); printf("\033[0m"); } @@ -169,7 +172,7 @@ void set_xy(int x, int y, char c){ void draw_xy(int x, int y, char c){ /* FIXME: check if x and y are valid!!!! */ printf("\033[%d;%df",y+1,x+1); - putchar(c); + putchar(c); } void update_current(){ @@ -194,7 +197,7 @@ void check_bound(){ if (x<0) x=0; else if (x>=WIDTH) x = WIDTH-1; if (y<0) y=0; - else if (y>=HEIGHT) y = HEIGHT -1; + else if (y>=HEIGHT) y = HEIGHT -1; } void init_screen(){ @@ -215,7 +218,7 @@ void init_screen(){ void redraw(){ int i; - + printf("\033[2J\033[1;1H"); for (i=0;i': @@ -690,8 +695,6 @@ void commands(){ } - - int main(int argc, char *argv[]){ init(); -- cgit v1.2.3