Skip to content

Wrong regexp for click.unstyle() #1216

@asvetlov

Description

@asvetlov

The function uses strip_ansi() which in turn depends on _ansi_re regex: https://github.com/pallets/click/blob/master/click/_compat.py#L18

The pattern is: r'\033\[((?:\d|;)*)([a-zA-Z])'.
It is a little not full: \033[?25l and \033[?25h ANSI sequences used by cursor show/hide are not covered by the pattern.

I've changed it to r'\033\[([;\?0-9]*)([a-zA-Z])', it fixes my problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions