Override to support ANSI sequences. This method calls [cmd2.rich_utils.prepare_objects_for_rendering][] on the objects being printed. This ensures that strings containing ANSI style sequences are converted to Rich Text objects, so that Rich can correctly calculate th
(
self,
*objects: Any,
sep: str = " ",
end: str = "\n",
style: StyleType | None = None,
justify: JustifyMethod | None = None,
overflow: OverflowMethod | None = None,
no_wrap: bool | None = None,
emoji: bool | None = None,
markup: bool | None = None,
highlight: bool | None = None,
width: int | None = None,
height: int | None = None,
crop: bool = True,
soft_wrap: bool | None = None,
new_line_start: bool = False,
)
| 470 | raise BrokenPipeError |
| 471 | |
| 472 | def print( |
| 473 | self, |
| 474 | *objects: Any, |
| 475 | sep: str = " ", |
| 476 | end: str = "\n", |
| 477 | style: StyleType | None = None, |
| 478 | justify: JustifyMethod | None = None, |
| 479 | overflow: OverflowMethod | None = None, |
| 480 | no_wrap: bool | None = None, |
| 481 | emoji: bool | None = None, |
| 482 | markup: bool | None = None, |
| 483 | highlight: bool | None = None, |
| 484 | width: int | None = None, |
| 485 | height: int | None = None, |
| 486 | crop: bool = True, |
| 487 | soft_wrap: bool | None = None, |
| 488 | new_line_start: bool = False, |
| 489 | ) -> None: |
| 490 | """Override to support ANSI sequences. |
| 491 | |
| 492 | This method calls [cmd2.rich_utils.prepare_objects_for_rendering][] on the |
| 493 | objects being printed. This ensures that strings containing ANSI style |
| 494 | sequences are converted to Rich Text objects, so that Rich can correctly |
| 495 | calculate their display width. |
| 496 | """ |
| 497 | prepared_objects = prepare_objects_for_rendering(*objects) |
| 498 | |
| 499 | super().print( |
| 500 | *prepared_objects, |
| 501 | sep=sep, |
| 502 | end=end, |
| 503 | style=style, |
| 504 | justify=justify, |
| 505 | overflow=overflow, |
| 506 | no_wrap=no_wrap, |
| 507 | emoji=emoji, |
| 508 | markup=markup, |
| 509 | highlight=highlight, |
| 510 | width=width, |
| 511 | height=height, |
| 512 | crop=crop, |
| 513 | soft_wrap=soft_wrap, |
| 514 | new_line_start=new_line_start, |
| 515 | ) |
| 516 | |
| 517 | def log( |
| 518 | self, |