diff --git a/src/click/_compat.py b/src/click/_compat.py index 9e14ace5f..feb836628 100644 --- a/src/click/_compat.py +++ b/src/click/_compat.py @@ -129,7 +129,7 @@ def writable(self) -> bool: if x is not None: return t.cast(bool, x()) try: - self._stream.write("") # type: ignore + self._stream.write(b"") except Exception: try: self._stream.write(b"") diff --git a/src/click/_termui_impl.py b/src/click/_termui_impl.py index 24dec542e..a6c7e6b36 100644 --- a/src/click/_termui_impl.py +++ b/src/click/_termui_impl.py @@ -251,9 +251,9 @@ def render_progress(self) -> None: self.width = 0 clutter_length = term_len(self.format_progress_line()) new_width = max(0, shutil.get_terminal_size().columns - clutter_length) - if new_width < old_width: + if new_width < old_width and self.max_width is not None: buf.append(BEFORE_BAR) - buf.append(" " * self.max_width) # type: ignore + buf.append(" " * self.max_width) self.max_width = new_width self.width = new_width