diff options
author | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-11 04:35:35 -0800 |
---|---|---|
committer | Andy Wortman <ixineeringeverywhere@gmail.com> | 2017-11-11 16:00:31 -0800 |
commit | 73dc5dda6b8ca8a8bdae0f620442e359871b0152 (patch) | |
tree | 1a3a0ff74bedf1788079ba642eb222f6a4d23c9d /src/display | |
parent | 3601bf6433d46dea4dd1960f7a3cdc514602983d (diff) |
start adding help reference
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs index 0eeba68..6df3b28 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -25,7 +25,8 @@ pub enum Infos { Thread(Vec<TweetId>), Event(tw::events::Event), DM(String), - User(tw::user::User) + User(tw::user::User), + Text(Vec<String>) } const COMPOSE_HEIGHT: u16 = 5; @@ -164,6 +165,10 @@ pub fn paint(tweeter: &mut ::tw::TwitterCache) -> Result<(), std::io::Error> { for info in last_few_twevent { let to_draw: Vec<String> = match info { + Infos::Text(lines) => { + let wrapped = into_display_lines(lines, width); + wrapped.into_iter().rev().collect() + } Infos::Tweet(id) => { let pre_split: Vec<String> = render_twete(&id, tweeter); let total_length: usize = pre_split.iter().map(|x| x.len()).sum(); @@ -411,7 +416,7 @@ pub fn render_twete(twete_id: &TweetId, tweeter: &mut tw::TwitterCache) -> Vec<S result.push(format!("{} id {}{}{}", id_color, qt.internal_id, qt.reply_to_tweet.clone() - .map(|id_str| TweetId::Twitter(id.to_owned())) + .map(|id_str| TweetId::Twitter(id_str.to_owned())) .map(|id| tweeter.retrieve_tweet(&id) .and_then(|tw| Some(format!(" reply to {}", tw.internal_id))) .unwrap_or(format!(" reply to {}", id)) |