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

Lack of Style Options for Spaces Between Key and Description in Short Help View #571

Open
rrrodzilla opened this issue Jul 29, 2024 · 3 comments · May be fixed by #685
Open

Lack of Style Options for Spaces Between Key and Description in Short Help View #571

rrrodzilla opened this issue Jul 29, 2024 · 3 comments · May be fixed by #685
Labels
bug Something isn't working

Comments

@rrrodzilla
Copy link

rrrodzilla commented Jul 29, 2024

bubbles/help/help.go

Lines 132 to 134 in a9344b5

str := sep +
m.Styles.ShortKey.Inline(true).Render(kb.Help().Key) + " " +
m.Styles.ShortDesc.Inline(true).Render(kb.Help().Desc)

First, thank you for your work on this package.

In the ShortHelpView function, the space between the key and description does not have dedicated style options. This results in inconsistent styling, especially when a custom background color is applied to the terminal when using the alt window for a full screen TUI. As shown in the attached screenshot, the spaces remain unstyled with no ability to apply custom styles, which leads to visual discrepancies. All other parts of the help component have configurable styles, but these spaces do not, limiting the ability to achieve a consistent look and feel.

Screenshot:
image

To resolve this issue, I suggest the following approach:

  • Apply Separator Style: Use the existing SeparatorStyle to style the spaces between the key and description.
    Alternatively, you could:
  • Add a Whitespace Style: Introduce a WhitespaceStyle to style the spaces between the key and description, similar to the JoinHorizontal and JoinVertical methods.

If you settle on an approach, I'm happy to implement it and provide a PR. Thank you for considering this enhancement.

@bashbunni
Copy link
Member

Hey @rrrodzilla we would want to implement a whitespace style. The separator separates items, not the key and descriptions of an item, so having a new style would be the safest choice here.

@rrrodzilla
Copy link
Author

Cool! Happy to put that together.

@bashbunni
Copy link
Member

Thank you!!

rrrodzilla added a commit to rrrodzilla/bubbles that referenced this issue Dec 6, 2024
Added WhitespaceStyle fields to both short and full help Styles struct,
llowing customization of whitespace appearance between keys and descriptions.
Previously whitespace was unstyled, now it matches the aesthetic of other
elements and can be customized (e.g. with background colors for testing).

- Added ShortWhitespace and FullWhitespace to Styles struct
- Modified ShortHelpView to use styled whitespace between key and desc
- Modified FullHelpView to use styled whitespace between key and desc
- Added tests to verify whitespace styling behavior

Fixes charmbracelet#571
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