From 33b497d0a2187957dbb27da462e969f93119c85b Mon Sep 17 00:00:00 2001 From: Alex Thannhauser Date: Thu, 12 Jun 2025 10:49:30 -0500 Subject: [PATCH] reuse the same line of text when showing progress --- main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/main.c b/main.c index ed9464a..c4346e6 100644 --- a/main.c +++ b/main.c @@ -478,9 +478,19 @@ void calculate_simplifications(void) { int left = N - todo_n; + if (print_with_color) + { + printf("\e[2K"); + } + printf("%i of %i (%.2f%%): [%i] ", left, N, (100.0 * left / N), cost); print(truthtable, 0), puts(""); + + if (print_with_color) + { + printf("\e[1A"); + } } // consider NOT: @@ -670,6 +680,11 @@ void calculate_simplifications(void) } } } + + if (verbose && print_with_color) + { + printf("\e[2K"); + } } void get_simplifications(void)