From e55b8eb7640a2f39bf3fd91594b1bdfe0c88923c Mon Sep 17 00:00:00 2001 From: collectnis Date: Sun, 11 Jan 2026 10:34:16 +0000 Subject: [PATCH 1/4] [CLI] Fix output artifacts on Linux/WSL by clearing line on \r --- src/lib_ccx/utility.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/lib_ccx/utility.c b/src/lib_ccx/utility.c index 8729c0db8..d212541ff 100644 --- a/src/lib_ccx/utility.c +++ b/src/lib_ccx/utility.c @@ -179,17 +179,23 @@ void mprint(const char *fmt, ...) if (!ccx_options.messages_target) return; va_start(args, fmt); - if (ccx_options.messages_target == CCX_MESSAGES_STDOUT) + + FILE *target = (ccx_options.messages_target == CCX_MESSAGES_STDOUT) ? stdout : stderr; + + if (fmt[0] == '\r') { - vfprintf(stdout, fmt, args); - fflush(stdout); - } - else - { - vfprintf(stderr, fmt, args); - fflush(stderr); - } - va_end(args); +#ifndef _WIN32 + fprintf(target, "\r\033[K"); // Clear the line first + fmt++; // Skip the '\r' so only the clean text gets printed next +#endif + // Windows (legacy console) does not support ANSI sequences; fallback to standard \r + // and vfprintf below handles it the old-fashioned way. + } + + vfprintf(target, fmt, args); + fflush(target); + + va_end(args); } /* Shorten some debug output code. */ From c515578e37b02b55c651867431be6c5217ce6c24 Mon Sep 17 00:00:00 2001 From: collectnis Date: Sun, 11 Jan 2026 11:30:54 +0000 Subject: [PATCH 2/4] docs: update changelog --- docs/CHANGES.TXT | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/CHANGES.TXT b/docs/CHANGES.TXT index 5e37a7913..25d0e6e57 100644 --- a/docs/CHANGES.TXT +++ b/docs/CHANGES.TXT @@ -1,3 +1,5 @@ +- Fix: Clear status line output on Linux/WSL to prevent text artifacts (#2017) + 0.96.5 (2026-01-05) ------------------- - New: Add support for raw CDP (Caption Distribution Packet) files (#1406) From 8fbfd68426f95e28dc9d65c7fa46cc0c1d93cd6d Mon Sep 17 00:00:00 2001 From: collectnis Date: Sun, 11 Jan 2026 13:31:55 +0000 Subject: [PATCH 3/4] style: fix formatting alignment --- src/lib_ccx/utility.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib_ccx/utility.c b/src/lib_ccx/utility.c index d212541ff..b53e0f440 100644 --- a/src/lib_ccx/utility.c +++ b/src/lib_ccx/utility.c @@ -186,11 +186,10 @@ void mprint(const char *fmt, ...) { #ifndef _WIN32 fprintf(target, "\r\033[K"); // Clear the line first - fmt++; // Skip the '\r' so only the clean text gets printed next + fmt++; // Skip the '\r' so only the clean text gets printed next #endif - // Windows (legacy console) does not support ANSI sequences; fallback to standard \r - // and vfprintf below handles it the old-fashioned way. - } + } + // Windows (legacy console) does not support ANSI sequences; fallback to standard \r; and vfprintf below handles it the old-fashioned way. vfprintf(target, fmt, args); fflush(target); From b7b10419ec87ca7abcc8fcd67bc96f613705d47d Mon Sep 17 00:00:00 2001 From: collectnis Date: Sun, 11 Jan 2026 13:46:00 +0000 Subject: [PATCH 4/4] style: fix formatting alignment --- src/lib_ccx/utility.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib_ccx/utility.c b/src/lib_ccx/utility.c index b53e0f440..00f213414 100644 --- a/src/lib_ccx/utility.c +++ b/src/lib_ccx/utility.c @@ -179,22 +179,22 @@ void mprint(const char *fmt, ...) if (!ccx_options.messages_target) return; va_start(args, fmt); - + FILE *target = (ccx_options.messages_target == CCX_MESSAGES_STDOUT) ? stdout : stderr; - + if (fmt[0] == '\r') { -#ifndef _WIN32 - fprintf(target, "\r\033[K"); // Clear the line first - fmt++; // Skip the '\r' so only the clean text gets printed next +#ifndef _WIN32 + fprintf(target, "\r\033[K"); // Clear the line first + fmt++; // Skip the '\r' so only the clean text gets printed next #endif } // Windows (legacy console) does not support ANSI sequences; fallback to standard \r; and vfprintf below handles it the old-fashioned way. - + vfprintf(target, fmt, args); fflush(target); - va_end(args); + va_end(args); } /* Shorten some debug output code. */