Render buffered output, and clear buffer.
(self, buffer: Iterable[Segment])
| 2130 | del self._buffer[:] |
| 2131 | |
| 2132 | def _render_buffer(self, buffer: Iterable[Segment]) -> str: |
| 2133 | """Render buffered output, and clear buffer.""" |
| 2134 | output: List[str] = [] |
| 2135 | append = output.append |
| 2136 | color_system = self._color_system |
| 2137 | legacy_windows = self.legacy_windows |
| 2138 | not_terminal = not self.is_terminal |
| 2139 | if self.no_color and color_system: |
| 2140 | buffer = Segment.remove_color(buffer) |
| 2141 | for text, style, control in buffer: |
| 2142 | if style: |
| 2143 | append( |
| 2144 | style.render( |
| 2145 | text, |
| 2146 | color_system=color_system, |
| 2147 | legacy_windows=legacy_windows, |
| 2148 | ) |
| 2149 | ) |
| 2150 | elif not (not_terminal and control): |
| 2151 | append(text) |
| 2152 | |
| 2153 | rendered = "".join(output) |
| 2154 | return rendered |
| 2155 | |
| 2156 | def input( |
| 2157 | self, |
no test coverage detected