diff --git a/src/cli_util.rs b/src/cli_util.rs index 212972474..fb623f49f 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -1475,7 +1475,7 @@ pub fn create_ui() -> (Ui, Result<(), CommandError>) { match read_config() { Ok(user_settings) => (Ui::for_terminal(user_settings), Ok(())), Err(err) => { - let ui = Ui::for_terminal(UserSettings::from_config(crate::config::default_config())); + let ui = Ui::new(); (ui, Err(CommandError::ConfigError(err.to_string()))) } } diff --git a/src/ui.rs b/src/ui.rs index 8e4de4b06..9424e0be1 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -114,7 +114,17 @@ fn pager_setting(settings: &UserSettings) -> FullCommandArgs { .unwrap_or_else(|_| "less -FRX".into()) } +impl Default for Ui { + fn default() -> Self { + Self::new() + } +} + impl Ui { + pub fn new() -> Ui { + Self::for_terminal(UserSettings::from_config(crate::config::default_config())) + } + pub fn for_terminal(settings: UserSettings) -> Ui { let cwd = std::env::current_dir().unwrap(); let color = use_color(color_setting(&settings));