From 0522ef659553292f546fb1f3af43cfd2f4b07bb2 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Mon, 12 Aug 2019 09:02:50 +0100 Subject: fix read of command scripts and script-mode --- screen.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'screen.c') diff --git a/screen.c b/screen.c index d60abb2..d85ff81 100644 --- a/screen.c +++ b/screen.c @@ -58,7 +58,7 @@ char get_mark(char dir){ void status_bar(){ - if (silent) + if (script) return; printf("\033[%d;1f\033[7m", HEIGHT+1); printf("%*s", WIDTH-1, ""); @@ -78,7 +78,7 @@ void status_bar(){ char get_key(FILE *fc, char *msg){ - if (silent) + if (script) return 0; printf("\033[%d;1f\033[7m", HEIGHT+1); printf("%*s", WIDTH, ""); @@ -92,7 +92,7 @@ char get_key(FILE *fc, char *msg){ void get_string(FILE *fc, char *msg, char *s, int sz){ - if (!silent){ + if (!script){ printf("\033[%d;1f\033[7m", HEIGHT+1); printf("%*s", WIDTH, ""); printf("\033[%d;1f\033[7m", HEIGHT+1); @@ -106,9 +106,10 @@ void get_string(FILE *fc, char *msg, char *s, int sz){ } fgets(s, sz, fc); s[strlen(s)-1] = '\0'; - tcsetattr(0, TCSANOW, &t2); - if (!silent) + if (!script){ + tcsetattr(0, TCSANOW, &t2); fflush(stdout); + } } int is_yes(char c){ @@ -119,7 +120,7 @@ int is_yes(char c){ void show_cursor(){ - if (silent) + if (script) return; printf("\033[%d;%df", y+1, x+1); fflush(stdout); @@ -144,7 +145,7 @@ void set_cur(char c){ void draw_xy(int x, int y, char c){ /* FIXME: check if x and y are valid!!!! */ - if (silent) + if (script) return; printf("\033[%d;%df",y+1,x+1); putchar(c); @@ -152,7 +153,7 @@ void draw_xy(int x, int y, char c){ } void update_current(){ - if (silent) + if (script) return; printf("\033[%d;%df",y+1,x+1); putchar(screen.l[y].s[x]); @@ -226,7 +227,7 @@ void reset_styles(){ void redraw(){ int i; - if (silent) + if (script) return; printf("\033[2J\033[1;1H"); for (i=0;i