def update_decorated_match(self, max_len: Optional[int] = None) -> None:
        """Update the cached decorated match formatted string, and
        dirty the line, if needed"""
        if self.hovered and self.selected:
            attributes = (
                curses.COLOR_WHITE,
                curses.COLOR_RED,
                FormattedText.BOLD_ATTRIBUTE,
            )
        elif self.hovered:
            attributes = (
                curses.COLOR_WHITE,
                curses.COLOR_BLUE,
                FormattedText.BOLD_ATTRIBUTE,
            )
        elif self.selected:
            attributes = (
                curses.COLOR_WHITE,
                curses.COLOR_GREEN,
                FormattedText.BOLD_ATTRIBUTE,
            )
        elif not self.all_input:
            attributes = (0, 0, FormattedText.UNDERLINE_ATTRIBUTE)
        else:
            attributes = (0, 0, 0)

        decorator_text = self.get_decorator()

        # we may not be connected to a controller (during process_input,
        # for example)
        if self.controller:
            self.controller.dirty_line(self.index)

        plain_text = decorator_text + self.get_match()
        if max_len and len(plain_text + str(self.before_text)) > max_len:
            # alright, we need to chop the ends off of our
            # decorated match and glue them together with our
            # truncation decorator. We subtract the length of the
            # before text since we consider that important too.
            space_allowed = (
                max_len
                - len(self.TRUNCATE_DECORATOR)
                - len(decorator_text)
                - len(str(self.before_text))
            )
            mid_point = int(space_allowed / 2)
            begin_match = plain_text[0:mid_point]
            end_match = plain_text[-mid_point : len(plain_text)]
            plain_text = begin_match + self.TRUNCATE_DECORATOR + end_match

        self.decorated_match = FormattedText(
            FormattedText.get_sequence_for_attributes(*attributes) + plain_text
        )
Update the cached decorated match formatted string, and
        dirty the line, if needed
src/pathpicker/line_format.py