From 1aa7efdd7a8dcfd1a55f30c2754d1e473f0bb59b Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Wed, 24 Jul 2019 15:36:56 +0100 Subject: force flush on ANSI commands --- gramscii.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gramscii.c') diff --git a/gramscii.c b/gramscii.c index 8162835..69f7b10 100644 --- a/gramscii.c +++ b/gramscii.c @@ -106,6 +106,7 @@ void cleanup(int s){ printf("\033[;H\033[2J"); tcsetattr(0, TCSANOW, &t1); + fflush(stdout); exit(0); } @@ -147,6 +148,7 @@ void status_bar(){ printf(" '%d' ", screen[y][x]); #endif printf("\033[0m"); + fflush(stdout); } char get_key(char *msg){ @@ -156,6 +158,7 @@ char get_key(char *msg){ printf("\033[%d;1f\033[7m", HEIGHT+1); printf("%s", msg); printf("\033[0m"); + fflush(stdout); return getchar(); } @@ -173,6 +176,7 @@ void get_string(char *msg, char *s, int sz){ fgets(s, sz, stdin); s[strlen(s)-1] = '\0'; tcsetattr(0, TCSANOW, &t2); + fflush(stdout); } int is_yes(char c){ @@ -183,6 +187,7 @@ int is_yes(char c){ void show_cursor(){ printf("\033[%d;%df", y+1, x+1); + fflush(stdout); } void set_cur(char c){ @@ -198,11 +203,13 @@ 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); + fflush(stdout); } void update_current(){ printf("\033[%d'%df",y+1,x+1); putchar(screen[y][x]); + fflush(stdout); } void erase_line(char *s){ @@ -360,6 +367,7 @@ int progr_y(int dir){ void set_video(int v){ printf("\033[%dm", v); + fflush(stdout); } /*** Lines and markers ***/ -- cgit v1.2.3