From 75b398ed87c4be384b1fcd614fbcfcf49d297bc0 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 24 Dec 2017 22:06:20 -0800 Subject: adjust line clearing behavior to alleviate flickering --- src/display/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/display/mod.rs') diff --git a/src/display/mod.rs b/src/display/mod.rs index 37de481..e747eec 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -561,7 +561,7 @@ pub fn paint(tweeter: &::tw::TwitterCache, display_info: &mut DisplayInfo) -> Re } }; for line in to_draw { - print!("{}{}{}", cursor::Goto(1, height - h), clear::CurrentLine, line); + print!("{}{}{}", cursor::Goto(1, height - h), line, clear::UntilNewline); h = h + 1; if h >= height { break; -- cgit v1.1 From 2e2cee3357bc667ff2b2a0eeeb0a0ddb94fd8d93 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 24 Dec 2017 22:24:50 -0800 Subject: fix line wrapping bug when composing, and wrapping bug for long status lines --- src/display/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/display/mod.rs') 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::()); 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 = 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::())); let msg_lines = into_display_lines(msg.split("\n").map(|x| x.to_owned()).collect(), width - 2); -- cgit v1.1