diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2013-08-23 18:31:13 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2013-08-23 18:31:13 +0200 |
| commit | ae63a3e400970a895d03ec1ef359ba86217c854b (patch) | |
| tree | bc36eb1147f2a165a836315aa91a1cd77ba2684f | |
| parent | db55cd92dec88c3ff025ecf8b4900aca4520bea6 (diff) | |
| download | rust-ae63a3e400970a895d03ec1ef359ba86217c854b.tar.gz rust-ae63a3e400970a895d03ec1ef359ba86217c854b.zip | |
Make getopts count (and thus align/paginate) in terms of codepoints not bytes.
| -rw-r--r-- | src/libextra/getopts.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libextra/getopts.rs b/src/libextra/getopts.rs index 000520fe41e..f5efa940530 100644 --- a/src/libextra/getopts.rs +++ b/src/libextra/getopts.rs @@ -501,6 +501,7 @@ pub enum FailType { pub mod groups { use getopts::{HasArg, Long, Maybe, Multi, No, Occur, Opt, Optional, Req}; use getopts::{Short, Yes}; + use std::str; /** one group of options, e.g., both -h and --help, along with * their shared description and properties @@ -691,7 +692,7 @@ pub mod groups { // FIXME: #5516 // here we just need to indent the start of the description - let rowlen = row.len(); + let rowlen = str::count_chars(row, 0, row.len()); if rowlen < 24 { do (24 - rowlen).times { row.push_char(' ') @@ -798,7 +799,7 @@ pub mod groups { cont }; - ss.iter().enumerate().advance(|x| machine(x)); + ss.char_offset_iter().advance(|x| machine(x)); // Let the automaton 'run out' by supplying trailing whitespace while cont && match state { B | C => true, A => false } { |
