force flush on ANSI commands - gramscii - A simple editor for ASCII box-and-arrow charts DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 1aa7efdd7a8dcfd1a55f30c2754d1e473f0bb59b DIR parent 5cfc45336702f9edb4e1c65890157e7ccdafd482 HTML Author: KatolaZ <katolaz@freaknet.org> Date: Wed, 24 Jul 2019 15:36:56 +0100 force flush on ANSI commands Diffstat: M gramscii.c | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) --- DIR diff --git 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 ***/