You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
phetch/src/text.rs

31 lines
655 B
Rust

5 years ago
use ui::{Action, Key, View};
pub struct TextView {
url: String,
raw: String,
}
impl View for TextView {
fn process_input(&mut self, c: Key) -> Action {
5 years ago
Action::Unknown
5 years ago
}
fn render(&self, width: u16, height: u16) -> String {
5 years ago
let mut out = String::new();
for (i, line) in self.raw.split_terminator('\n').enumerate() {
if i as u16 > height - 4 {
break;
}
out.push_str(line);
out.push('\n');
}
out
5 years ago
}
}
impl TextView {
pub fn from(url: String, response: String) -> TextView {
TextView { url, raw: response }
}
}