From d74606ead60d524eb72afad2cd8b45facd6c5d40 Mon Sep 17 00:00:00 2001 From: Marvin Löbel Date: Sat, 23 Mar 2013 17:25:16 +0100 Subject: pre-rebase commit --- src/libstd/getopts.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index de8a8f34381..f837f776b96 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -601,7 +601,7 @@ pub mod groups { row += match short_name.len() { 0 => ~"", 1 => ~"-" + short_name + " ", - _ => fail!(~"the short name should only be 1 char long"), + _ => fail!(~"the short name should only be 1 ascii char long"), }; // long option @@ -617,6 +617,7 @@ pub mod groups { Maybe => ~"[" + hint + ~"]", }; + // FIXME: #5516 // here we just need to indent the start of the description let rowlen = row.len(); row += if rowlen < 24 { @@ -625,8 +626,22 @@ pub mod groups { desc_sep }; + // Normalize desc to contain words seperated by one space character + let mut desc_normalized_whitespace = ~str + for desc.each_word |word| { + desc_normalized_whitespace.push_str(word); + desc_normalized_whitespace.push_char(' '); + } + + // FIXME: #5516 + let mut desc_rows: ~[~str] = ~[]; + for desc_normalized_whitespace.each_split_within(54) |substr| { + desc_rows.push(~substr); + } + + // FIXME: #5516 // wrapped description - row += str::connect(str::split_within(desc, 54), desc_sep); + row += str::connect(desc_rows, desc_sep); row }); -- cgit 1.4.1-3-g733a5