Add external_edit_file_suffix to config (#253)

This commit is contained in:
Ethan Reynolds 2024-04-11 23:50:26 -04:00 committed by GitHub
parent e5b284ed19
commit b995906c79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 2 deletions

View file

@ -507,6 +507,7 @@ pub struct TunableValues {
pub notifications: Notifications,
pub image_preview: Option<ImagePreviewValues>,
pub user_gutter_width: usize,
pub external_edit_file_suffix: String,
}
#[derive(Clone, Default, Deserialize)]
@ -530,6 +531,7 @@ pub struct Tunables {
pub notifications: Option<Notifications>,
pub image_preview: Option<ImagePreview>,
pub user_gutter_width: Option<usize>,
pub external_edit_file_suffix: Option<String>,
}
impl Tunables {
@ -557,6 +559,9 @@ impl Tunables {
notifications: self.notifications.or(other.notifications),
image_preview: self.image_preview.or(other.image_preview),
user_gutter_width: self.user_gutter_width.or(other.user_gutter_width),
external_edit_file_suffix: self
.external_edit_file_suffix
.or(other.external_edit_file_suffix),
}
}
@ -580,6 +585,9 @@ impl Tunables {
notifications: self.notifications.unwrap_or_default(),
image_preview: self.image_preview.map(ImagePreview::values),
user_gutter_width: self.user_gutter_width.unwrap_or(30),
external_edit_file_suffix: self
.external_edit_file_suffix
.unwrap_or_else(|| ".md".to_string()),
}
}
}