-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
HelpWriter: panic wrapping text containing unicode symbol chars in subcommand help #456
Comments
Thanks for filing this! I'll update soon 👍 |
I've looked into this a little but I'm having trouble re-producing the panic. Do you have a code sample which causes it, and know what your term width is when it panics? If you'd like, you can compile [dependencies]
clap = { version = "2.2.1", features = ["debug"]} |
Here is the actual CLI menu I currently have in my code, but with all functionality and imports removed (as you can see, it's from quite a silly project, oh well!). This particular configuration generates the panic with a terminal width of 80 chars. And here is the debug output:
|
Ah ok, thanks! Let me test this out with some solutions over the next few days and I should have this solved pretty quick. |
v2.2.2 on crates.io should have this fixed! |
Can confirm this appears to have fixed for me as well! 👍 |
Subcommand help text which contains more complex Unicode characters can cause the
help
command to panic.See below for a stacktrace. Adjusting the width of the CLI terminal can cause the problem to occur/not occur consistently based on the current width, so it's likely caused by the wrapping trying to split in the middle of a unicode character codepoint.
I believe this was introduced in 813d75d along with subcommand help text wrapping (which is really awesome otherwise!).
In general, I'd guess this is likely due to using a byte-based index somewhere instead of a unicode character iterator, but not certain where in the code I would address this.
The text was updated successfully, but these errors were encountered: