cansarigol/pdbr

Support for ANSI color codes

michprev opened this issue · 2 comments

Since pdbr uses rich under the hood, it would be nice to support ANSI color codes.

A minimal example:

import pdbr
from rich.console import Console


class Dummy:
    def __repr__(self):
        console = Console()
        with console.capture() as capture:
            console.print("[red]hello[/red]")
        return capture.get()


if __name__ == "__main__":
    dummy = Dummy()
    breakpoint()

which prints

[1m[31mhello[1m[0m

ipdb seems to support this.

pdbr version 0.7.6
rich version: 13.1.0

Thanks @michprev there was a bug in the print function. Could you check v0.7.7?

What a quick response! Now it works as expected, thank you 🙌