-
Notifications
You must be signed in to change notification settings - Fork 45
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
Panic on string with em-dash #129
Comments
The character in the error message is the Unicode em-dash (https://www.fileformat.info/info/unicode/char/2013/index.htm). However, both these programs compile and run fine:
so it's not just a problem with breaking on that character, or that character following a long string... |
Looks like this is fixed in master - using |
Hey @rkday, thanks for reporting this! I did fix an off-by-one error in #118 -- back then I thought it only affected the automatic hyphenation, but it might also be the cause of this: line 634 has
and the patch in #118 touches I better make a 0.10.0 release soon then! |
Thanks for supplying a failing test case -- I was able to shorten it to: #[test]
fn issue_129() {
// The dash is an em-dash which takes up four bytes. We used
// to panic since we tried to index into the character.
assert_eq!(wrap("x – x", 2), vec!["x", "–", "x"]);
} |
Here's an example program that causes the panic:
and here's the panic:
This is with textwrap 0.9.
The text was updated successfully, but these errors were encountered: