Separate out get_status_line code

This commit is contained in:
Austen Adler 2021-05-19 18:09:20 -04:00
parent 5d5a3e4a21
commit 6fe3f27c85
2 changed files with 10 additions and 10 deletions

View File

@ -379,6 +379,15 @@ impl Calculator {
} }
} }
pub fn get_status_line(&self) -> String {
format!(
"[{}] [{}] [{}]",
self.get_display_mode(),
self.get_angle_mode(),
if self.get_save_on_close() { "W" } else { "w" }
)
}
pub fn get_state(&self) -> &CalculatorState { pub fn get_state(&self) -> &CalculatorState {
&self.state &self.state
} }

View File

@ -194,16 +194,7 @@ impl App {
Span::styled("q", Style::default().add_modifier(Modifier::BOLD)), Span::styled("q", Style::default().add_modifier(Modifier::BOLD)),
Span::raw(" to exit, "), Span::raw(" to exit, "),
Span::styled("h", Style::default().add_modifier(Modifier::BOLD)), Span::styled("h", Style::default().add_modifier(Modifier::BOLD)),
Span::raw(format!( Span::raw(format!(" for help - {}", self.calculator.get_status_line(),)),
" for help - [{}] [{}] [{}]",
self.calculator.get_display_mode(),
self.calculator.get_angle_mode(),
if self.calculator.get_save_on_close() {
"W"
} else {
"w"
}
)),
] ]
} }
(None, _) => vec![ (None, _) => vec![