From 04072d36a1597e66d8034c98c30b76caf52c299b 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(-) diff --git a/src/display/mod.rs b/src/display/mod.rs index e747eec..8bd233a 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.take(width - 7); 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 From a97fab4894f1a4c4c80cc41db67b60daa50c5f4a Mon Sep 17 00:00:00 2001 From: iximeow Date: Sun, 24 Dec 2017 23:31:04 -0800 Subject: fix bug where no-param commands would only be accepted with an empty line following --- src/tw/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tw/mod.rs b/src/tw/mod.rs index f9fda69..2eb574f 100644 --- a/src/tw/mod.rs +++ b/src/tw/mod.rs @@ -535,6 +535,8 @@ fn parse_word_command<'a, 'b>(line: &'b str, commands: &[&'a Command]) -> Option if cmd.params == 0 { if line == cmd.keyword { return Some(("", &cmd)); + } else if line.starts_with(&format!("{} ", cmd.keyword)) { + return Some((line.get((cmd.keyword.len() + 1)..).unwrap().trim(), &cmd)); } } else if line.starts_with(cmd.keyword) { if line.find(" ").map(|x| x == cmd.keyword.len()).unwrap_or(false) { -- cgit v1.1