def __init__()

in src/pathpicker/formatted_text.py [0:0]


    def __init__(self, text: Optional[str] = None):
        self.text = text

        if self.text is not None:
            self.segments = re.split(self.ANSI_ESCAPE_FORMATTING, self.text)
            # re.split will insert a empty string if there is a match at the beginning
            # or it will return [string] if there is no match
            # create the invariant that every segment has a formatting segment, e.g
            # we will always have FORMAT, TEXT, FORMAT, TEXT
            self.segments.insert(0, "")
            self.plain_text = "".join(self.segments[1::2])