Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Over-highlighting of heading's extra space #157

Closed
kdeldycke opened this issue Jun 3, 2023 · 2 comments · Fixed by #158
Closed

Over-highlighting of heading's extra space #157

kdeldycke opened this issue Jun 3, 2023 · 2 comments · Fixed by #158
Labels
bug Something isn't working

Comments

@kdeldycke
Copy link
Contributor

Bug description

The space separating the Usage: header from the CLI name and argument schema is highlighted as if it was part of the heading.

To Reproduce

Given the following minimal Cloup CLI:

from cloup import HelpFormatter, HelpTheme, Context, command, Style, Color

SETTINGS = Context.settings(
    formatter_settings=HelpFormatter.settings(
        theme=HelpTheme(
            heading=Style(fg=Color.bright_blue, bold=True, underline=True),
        )
    )
)

@command(context_settings=SETTINGS)
def cli():
    pass

if __name__ == '__main__':
    cli()

If I run this with the latest version of Cloup, I get the following help screen:

Screenshot 2023-06-03 at 10 19 18

Expected behavior

Instead, I expect the first line of the help screen renders like this:

Screenshot 2023-06-03 at 10 24 23

Notice how the space after Usage: is not underlined.

I.e. the first line should not produce:

"\x1b[94m\x1b[1m\x1b[4mUsage: \x1b[0mcloup_heading_highlight.py [OPTIONS]"

But:

"\x1b[94m\x1b[1m\x1b[4mUsage:\x1b[0m cloup_heading_highlight.py [OPTIONS]"
@kdeldycke kdeldycke added the bug Something isn't working label Jun 3, 2023
@janluke
Copy link
Owner

janluke commented Jun 3, 2023

Thanks for reporting!

@kdeldycke
Copy link
Contributor Author

Thanks @janluke for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants