aboutsummaryrefslogtreecommitdiff
path: root/src/display
diff options
context:
space:
mode:
authorAndy Wortman <ixineeringeverywhere@gmail.com>2017-12-24 22:24:50 -0800
committerAndy Wortman <ixineeringeverywhere@gmail.com>2017-12-24 23:00:17 -0800
commitd0573788b3be793dcaeaf2c369c602a929c308b6 (patch)
tree5721e1a8ab665977e62a630049237e6b422ebcd3 /src/display
parent617fc20868829f8cc8317ffde8fe5f858195950a (diff)
fix line wrapping bug when composing, and wrapping bug for long status lines
Diffstat (limited to 'src/display')
-rw-r--r--src/display/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/display/mod.rs b/src/display/mod.rs
index e747eec..6115472 100644
--- a/src/display/mod.rs
+++ b/src/display/mod.rs
@@ -412,7 +412,7 @@ pub fn paint(tweeter: &::tw::TwitterCache, display_info: &mut DisplayInfo) -> Re
{
let to_show = display_info.log[first_tail_log..last_tail_log].iter().rev();
for line in to_show {
- print!("{}{}{}/{}: {}", cursor::Goto(1, height - i), clear::CurrentLine, display_info.log.len() - 1 - i as usize, display_info.log.len() - 1, line);
+ print!("{}{}{}/{}: {}", cursor::Goto(1, height - i), clear::CurrentLine, display_info.log.len() - 1 - i as usize, display_info.log.len() - 1, line.chars().take(width.saturating_sub(7) as usize).collect::<String>());
i = i + 1;
}
}
@@ -472,7 +472,7 @@ pub fn paint(tweeter: &::tw::TwitterCache, display_info: &mut DisplayInfo) -> Re
Some(DisplayMode::Reply(twid, msg)) => {
let mut lines: Vec<String> = vec![];
lines.push(std::iter::repeat("-").take((width as usize).saturating_sub(2)).collect());
- lines.extend(render_twete(&twid, tweeter, display_info, Some(width)));
+ lines.extend(render_twete(&twid, tweeter, display_info, Some(width - 2)));
let reply_delineator = "--------reply";
lines.push(format!("{}{}", reply_delineator, std::iter::repeat("-").take((width as usize).saturating_sub(reply_delineator.len() + 2)).collect::<String>()));
let msg_lines = into_display_lines(msg.split("\n").map(|x| x.to_owned()).collect(), width - 2);