From eb0d99941c9241aeda4159a3e622c38070bd1c6b Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Thu, 17 Sep 2020 22:15:29 +0200 Subject: rust: Better padded/aligned sender column --- rust/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/src/main.rs b/rust/src/main.rs index 1ce64c6..5cf9666 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -454,7 +454,7 @@ impl State { } HItem::Service(msg) => { - (String::from("--"), msg.as_str()) + (String::from(" --"), msg.as_str()) } }; @@ -462,7 +462,7 @@ impl State { let mut done = false; for (i, line) in lines.iter().enumerate().rev() { if i == 0 { - print!("{}{}", cursor::Goto(self.layout.rlsepx + 2, y + 1), prefix); + print!("{}{}", cursor::Goto(nicksepx - u16::try_from(prefix.len()).unwrap(), y + 1), prefix); } print!("{}{}", cursor::Goto(nicksepx + 3, y + 1), line); if y == 0 { done = true; break; } @@ -497,7 +497,7 @@ impl State { data.maxnicklen = data.maxnicklen.max(msg.username.len() + 2); } HItem::Service(_) => { - data.maxnicklen = data.maxnicklen.max(2); + data.maxnicklen = data.maxnicklen.max(3); } } self.rooms.get_mut(room).unwrap().history.push(item); -- cgit v1.2.3-54-g00ecf