Add a serializer for the jump alphabet config option (#10156)
Without a serializer, we drop the custom alphabet when making config modifications like with `:set`. For example before this commit, `:set mouse false` would reset a custom alphabet to the default.
This commit is contained in:
parent
5fece0054d
commit
1539312558
1 changed files with 12 additions and 1 deletions
|
@ -212,6 +212,14 @@ impl Default for FilePickerConfig {
|
|||
}
|
||||
}
|
||||
|
||||
fn serialize_alphabet<S>(alphabet: &[char], serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
let alphabet: String = alphabet.iter().collect();
|
||||
serializer.serialize_str(&alphabet)
|
||||
}
|
||||
|
||||
fn deserialize_alphabet<'de, D>(deserializer: D) -> Result<Vec<char>, D::Error>
|
||||
where
|
||||
D: Deserializer<'de>,
|
||||
|
@ -323,7 +331,10 @@ pub struct Config {
|
|||
#[serde(default)]
|
||||
pub indent_heuristic: IndentationHeuristic,
|
||||
/// labels characters used in jumpmode
|
||||
#[serde(skip_serializing, deserialize_with = "deserialize_alphabet")]
|
||||
#[serde(
|
||||
serialize_with = "serialize_alphabet",
|
||||
deserialize_with = "deserialize_alphabet"
|
||||
)]
|
||||
pub jump_label_alphabet: Vec<char>,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue