Closed
Description
It should at minimum align to number of codepoints (characters), (and now that PR #8710 has landed, it should be doing that minimum), but the only correct thing would be to align to grapheme clusters.
test case
extern mod extra;
use extra::getopts::groups;
fn main() {
let optgroups = ~[
groups::optflag("a", "apple", "apple description"),
groups::optflag("b", "banana\u00AB", "banana description"),
groups::optflag("c", "br\xfbl\xe9e", "br\xfbl\xe9e quite long description"),
groups::optflag("k", "kiwi\u20AC", "kiwi description"),
groups::optflag("o", "orange\u2039", "orange description"),
groups::optflag("r",
"raspberry-but-making-this-option-way-too-long",
"raspberry description is also quite long indeed longer than every other piece of text we might encounter here and thus will be automatically broken up"),
];
println(usage("Usage: fruits", optgroups));
}
current output:
% rustc /tmp/issue5516.rs && /tmp/issue5516 --help
warning: no debug symbols in executable (-arch x86_64)
Usage: fruits
Options:
-a --apple apple description
-b --banana« banana description
-c --brûlée brûlée quite long descripti
-k --kiwi€ kiwi description
-o --orange‹ orange description
-r --raspberry-but-making-this-option-way-too-long
raspberry description is also quite long indeed longer
than every other piece of text we might encounter here
and thus will be automatically broken up
Note that in addition to things failing to line up, it is also cutting off the end of the text for the brûlée case. That issue should also be fixed.