| 275 | yield new_line |
| 276 | |
| 277 | def __rich_measure__( |
| 278 | self, console: "Console", options: "ConsoleOptions" |
| 279 | ) -> "Measurement": |
| 280 | _title = self._title |
| 281 | _, right, _, left = Padding.unpack(self.padding) |
| 282 | padding = left + right |
| 283 | renderables = [self.renderable, _title] if _title else [self.renderable] |
| 284 | |
| 285 | if self.width is None: |
| 286 | width = ( |
| 287 | measure_renderables( |
| 288 | console, |
| 289 | options.update_width(options.max_width - padding - 2), |
| 290 | renderables, |
| 291 | ).maximum |
| 292 | + padding |
| 293 | + 2 |
| 294 | ) |
| 295 | else: |
| 296 | width = self.width |
| 297 | return Measurement(width, width) |
| 298 | |
| 299 | |
| 300 | if __name__ == "__main__": # pragma: no cover |