aboutsummaryrefslogtreecommitdiff
path: root/src/display
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2017-11-11 04:35:35 -0800
committeriximeow <me@iximeow.net>2017-11-11 16:00:31 -0800
commita4f05a40e2f7146f429fef26a96c91a41baba499 (patch)
tree1a3a0ff74bedf1788079ba642eb222f6a4d23c9d /src/display
parente6091834b942f0c08c87a27223721c45795da627 (diff)
start adding help reference
Diffstat (limited to 'src/display')
-rw-r--r--src/display/mod.rs9
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))