# HG changeset patch
# User Edouard Tisserant <edouard.tisserant@gmail.com>
# Date 1736114708 -3600
# Node ID 0f5a69ab57a19b8197aa6e9890ae313d2b963849
# Parent  03ed01134858430089fc8e5494bb64cd7f4afc77
CLI: filter out useless progress refresh on stdout.

diff -r 03ed01134858 -r 0f5a69ab57a1 CLIController.py
--- a/CLIController.py	Tue Dec 17 21:18:40 2024 +0100
+++ b/CLIController.py	Sun Jan 05 23:05:08 2025 +0100
@@ -19,12 +19,13 @@
 class Log:
 
     def __init__(self):
-        self.crlfpending = False
+        self.last_progress = None
 
     def write(self, s):
         if s:
-            if self.crlfpending:
-                sys.stdout.write("\n")
+            if self.last_progress:
+                sys.stdout.write(f"{self.last_progress}\n")
+                self.last_progress = None
             sys.stdout.write(s)
             sys.stdout.flush()
             self.crlfpending = 0
@@ -44,10 +45,7 @@
         return False
 
     def progress(self, s):
-        if s:
-            sys.stdout.write(s+"\r")
-            self.crlfpending = True
-
+        self.last_progress = s
 
 def with_project_loaded(func):
     @wraps(func)