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

Add more intelligent line breaks for tap legends #123

Open
caksoylar opened this issue Oct 21, 2024 · 0 comments
Open

Add more intelligent line breaks for tap legends #123

caksoylar opened this issue Oct 21, 2024 · 0 comments

Comments

@caksoylar
Copy link
Owner

caksoylar commented Oct 21, 2024

Currently tap legends are split to lines on spaces (and double spaces are converted to single and don't split). This causes some ugliness, especially with modifier functions where by default you have Ctl+ C forms. This renders OK on a tap legend due to splitting, but render as is in hold/shifted fields and it looks bad.

If we instead remove the space from modifier functions and split on word boundaries \b, we will have better visuals overall. This way, a string like Ctl+Shft+C can still be split like Ctl+Shift+/C, while still having no gaps in hold/shifted fields.

The idea is to still split on explicit spaces, then within each item, use textwrap.TextWrapper(width=something)._wrap_chunks(re.split(r'\b', text)) to get a further split to chunks. something can be draw_config.shrink_wide_legends since that's nominally the acceptable legend width inside a key. However this means that a value of 0 should disable the splitting along with the shrinking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant