Add newline at end of console status (#2343)
When downloading/uploading on the console, a pretty status bar is printed on a single line. At the end of the transfer, a newline needs to be added, or subsequent output will appear on the same line as the status bar.
diff --git a/chirp/chirp_common.py b/chirp/chirp_common.py index 16cbf40..0a34adc 100644 --- a/chirp/chirp_common.py +++ b/chirp/chirp_common.py @@ -1218,7 +1218,10 @@ class Status: pct = 0.0 ticks = "?" * 10
return "|%-10s| %2.1f%% %s" % (ticks, pct, self.msg)
s = "|%-10s| %2.1f%% %s" % (ticks, pct, self.msg)
if self.cur == self.max:
s += "\n"
return s
This seems like a layering violation. If I stringify a thing, I expect it to be mostly consistent and not imply details of how I'm using the string. Further, your '\n' at the end isn't valid on all platforms and won't have the desired effect there. You'll end up with a \n\r at the end of the last loop instead of a \r\n, which is what you'd want on Windows.
Why wouldn't we just print the newline once we're done spewing these lines from the caller and not make this inner thing do something based on how it thinks it's being called?
--Dan