This commit is contained in:
veeso
2021-01-23 16:38:36 +01:00
parent 56c580fc80
commit 859daa3107
2 changed files with 4 additions and 4 deletions

View File

@@ -193,7 +193,7 @@ impl SetupActivity {
} }
UserInterfaceInputField::FileFmt => { UserInterfaceInputField::FileFmt => {
// Push char to current file fmt // Push char to current file fmt
let mut file_fmt = config_cli.get_file_fmt().unwrap_or(String::new()); let mut file_fmt = config_cli.get_file_fmt().unwrap_or_default();
// Pop from file fmt // Pop from file fmt
file_fmt.pop(); file_fmt.pop();
// If len is 0, will become None // If len is 0, will become None
@@ -354,7 +354,7 @@ impl SetupActivity {
} }
UserInterfaceInputField::FileFmt => { UserInterfaceInputField::FileFmt => {
// Push char to current file fmt // Push char to current file fmt
let mut file_fmt = config_cli.get_file_fmt().unwrap_or(String::new()); let mut file_fmt = config_cli.get_file_fmt().unwrap_or_default();
file_fmt.push(ch); file_fmt.push(ch);
// update value // update value
config_cli.set_file_fmt(file_fmt); config_cli.set_file_fmt(file_fmt);

View File

@@ -123,7 +123,7 @@ impl SetupActivity {
); );
} }
UserInterfaceInputField::FileFmt => { UserInterfaceInputField::FileFmt => {
let file_fmt: String = cli.get_file_fmt().unwrap_or(String::new()); let file_fmt: String = cli.get_file_fmt().unwrap_or_default();
f.set_cursor( f.set_cursor(
ui_cfg_chunks[4].x + file_fmt.width() as u16 + 1, ui_cfg_chunks[4].x + file_fmt.width() as u16 + 1,
ui_cfg_chunks[4].y + 1, ui_cfg_chunks[4].y + 1,
@@ -412,7 +412,7 @@ impl SetupActivity {
fn draw_file_fmt_input(&self) -> Option<Paragraph> { fn draw_file_fmt_input(&self) -> Option<Paragraph> {
match &self.config_cli { match &self.config_cli {
Some(cli) => Some( Some(cli) => Some(
Paragraph::new(cli.get_file_fmt().unwrap_or(String::new())) Paragraph::new(cli.get_file_fmt().unwrap_or_default())
.style(Style::default().fg(match &self.tab { .style(Style::default().fg(match &self.tab {
SetupTab::SshConfig => Color::White, SetupTab::SshConfig => Color::White,
SetupTab::UserInterface(field) => match field { SetupTab::UserInterface(field) => match field {