recognize more gopher types, fix validation and a minor error

master
Lukáš Hozda 4 years ago
parent 53c88d4fb7
commit f37258f294

@ -68,7 +68,7 @@ impl BrowserState {
parsed_selector: String::new(), parsed_selector: String::new(),
bookmarks: Vec::new(), bookmarks: Vec::new(),
config: Config { config: Config {
start_uri: String::from("gopher://r-36.net:70"), start_uri: String::from("gopher://gopher.floodgap.com:70"),
cmd_text: String::from("less"), cmd_text: String::from("less"),
cmd_image: String::from("display"), cmd_image: String::from("display"),
cmd_browser: String::from("firefox"), cmd_browser: String::from("firefox"),
@ -306,14 +306,14 @@ impl BrowserState {
} }
for line in buffer.lines() { for line in buffer.lines() {
// if !is_valid_directory_entry(line.chars().next().unwrap_or('\0')) { if !is_valid_directory_entry(line.chars().next().unwrap_or('\0')) {
// println!( println!(
// "error: not a directory: [{}] {}", "invalid: [{}] {}",
// line.chars().next().unwrap_or('\0'), line.chars().next().unwrap_or('\0'),
// line.chars().skip(1).collect::<String>() line.chars().skip(1).collect::<String>()
// ); );
// return; continue;
// } }
self.handle_directory_line(line); self.handle_directory_line(line);
} }
@ -719,7 +719,7 @@ impl BrowserState {
line.chars().skip(2).next().unwrap_or('\0'), line.chars().skip(2).next().unwrap_or('\0'),
)); ));
}, },
_ => { x if !x.is_none() => {
self.follow_link( self.follow_link(
make_key( make_key(
line.chars().next().unwrap(), line.chars().next().unwrap(),
@ -728,6 +728,7 @@ impl BrowserState {
.unwrap_or(0), .unwrap_or(0),
); );
} }
_ => (),
} }
} }
/* never get's here but stops cc complaining */ /* never get's here but stops cc complaining */
@ -818,7 +819,7 @@ pub fn make_key_str(
pub fn is_valid_directory_entry(kind: char) -> bool { pub fn is_valid_directory_entry(kind: char) -> bool {
match kind { match kind {
'i' | '3' | '.' | '0' | '1' | '5' | '7' | '8' | '9' | 'g' | 'I' | 'p' | 'h' 'i' | '3' | '.' | '0' | '1' | '5' | '7' | '8' | '9' | 'g' | 'I' | 'p' | 'h' | '2' | 'd'
| 's' => true, | 's' => true,
_ => false, _ => false,
} }

Loading…
Cancel
Save