diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-11 21:37:22 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-06-12 12:21:04 +1000 |
| commit | 3ac00a94895f4d9a8119ef35494fddb9d66436ae (patch) | |
| tree | 05891e2d06bdd87071ec5df904f746494bdf8f7b /src/libextra/terminfo | |
| parent | 9fff8c6eba287e0ed7cce6014dc58482afe425b0 (diff) | |
std: remove substr & str::count_*, methodise char_len, implement slice_chars.
The confusing mixture of byte index and character count meant that every use of .substr was incorrect; replaced by slice_chars which only uses character indices. The old behaviour of `.substr(start, n)` can be emulated via `.slice_from(start).slice_chars(0, n)`.
Diffstat (limited to 'src/libextra/terminfo')
| -rw-r--r-- | src/libextra/terminfo/searcher.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libextra/terminfo/searcher.rs b/src/libextra/terminfo/searcher.rs index ecc99f74626..48a3e1e9c69 100644 --- a/src/libextra/terminfo/searcher.rs +++ b/src/libextra/terminfo/searcher.rs @@ -27,7 +27,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~path> { let homedir = os::homedir(); let mut dirs_to_search = ~[]; - let first_char = term.substr(0, 1); + let first_char = term.char_at(0); // Find search directory match getenv("TERMINFO") { @@ -57,12 +57,12 @@ pub fn get_dbpath_for_term(term: &str) -> Option<~path> { // Look for the terminal in all of the search directories for dirs_to_search.each |p| { - let newp = ~p.push_many(&[first_char.to_owned(), term.to_owned()]); + let newp = ~p.push_many(&[str::from_char(first_char), term.to_owned()]); if os::path_exists(p) && os::path_exists(newp) { return Some(newp); } // on some installations the dir is named after the hex of the char (e.g. OS X) - let newp = ~p.push_many(&[fmt!("%x", first_char[0] as uint), term.to_owned()]); + let newp = ~p.push_many(&[fmt!("%x", first_char as uint), term.to_owned()]); if os::path_exists(p) && os::path_exists(newp) { return Some(newp); } |
