-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix previous broken refactor key into helix-view #345
Conversation
/// Merge default config keys with user overwritten keys for custom | ||
/// user config. | ||
pub fn merge_keys(mut config: Config) -> Config { | ||
let mut delta = std::mem::take(&mut config.keys); | ||
for (mode, keys) in &mut *config.keys { | ||
keys.extend(delta.remove(mode).unwrap_or_default()); | ||
} | ||
config | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main change compared to last pull request, I am surprised it is just a few lines away.
.or_else(|| Some(Config::default())) | ||
.unwrap(); | ||
let config = match std::fs::read_to_string(conf_dir.join("config.toml")) { | ||
Ok(config) => merge_keys(toml::from_str(&config)?), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this minor change, it will only merge the keys if we successfully read from a config file. The merging shouldn't be part of the deserialization process.
Need to be used for autoinfo Revert "Revert "Refactor key into helix-view"" This reverts commit 10f9f72.
Need to be used for autoinfo
Revert "Revert "Refactor key into helix-view""
This reverts commit 10f9f72.
cc @wojciechkepka