From 416cc270068bbb2ec9f754228ab3522c3f8afa52 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 19 May 2021 20:55:31 -0400 Subject: [PATCH] Right align ~ marker as well --- src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ce80e02..eb56906 100644 --- a/src/main.rs +++ b/src/main.rs @@ -265,7 +265,17 @@ impl App { .saturating_sub(stack.len() as u16) .saturating_sub(2)) { - stack.insert(0, ListItem::new(Span::raw("~"))); + stack.insert( + 0, + ListItem::new(Span::raw(match self.calculator.calculator_alignment { + CalculatorAlignment::Left => String::from("~"), + CalculatorAlignment::Right => format!( + "{: >width$}", + "~", + width = (chunks[1].width as usize).saturating_sub(2) + ), + })), + ); } let stack = List::new(stack).block(Block::default().borders(Borders::ALL).title("Stack"));