Skip to content

Commit a8d5800

Browse files
authored
Fix ANSI control sequence support detection (#11708)
1 parent 23c9cb4 commit a8d5800

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ Bugs fixed
4747
package (triggered if using ``fontenc`` with ``T2A`` option and document
4848
language is not a Cyrillic one).
4949
Patch by Jean-François B.
50+
* #11675: Fix rendering of progression bars in environments that do not support
51+
ANSI control sequences.
52+
Patch by Bénédikt Tran.
5053

5154
Testing
5255
-------

sphinx/util/display.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from sphinx.locale import __
77
from sphinx.util import logging
8-
from sphinx.util.console import bold # type: ignore[attr-defined]
8+
from sphinx.util.console import bold, color_terminal # type: ignore[attr-defined]
99

1010
if False:
1111
from collections.abc import Iterable, Iterator
@@ -33,7 +33,8 @@ def status_iterator(
3333
verbosity: int = 0,
3434
stringify_func: Callable[[Any], str] = display_chunk,
3535
) -> Iterator[T]:
36-
single_line = verbosity < 1
36+
# printing on a single line requires ANSI control sequences
37+
single_line = verbosity < 1 and color_terminal()
3738
bold_summary = bold(summary)
3839
if length == 0:
3940
logger.info(bold_summary, nonl=True)

0 commit comments

Comments
 (0)