Skip to content
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

Merged
merged 1 commit into from
Jun 24, 2021

Conversation

pickfire
Copy link
Contributor

Need to be used for autoinfo

Revert "Revert "Refactor key into helix-view""

This reverts commit 10f9f72.

cc @wojciechkepka

@pickfire pickfire requested a review from archseer June 22, 2021 17:05
Comment on lines +340 to 348
/// 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
}
Copy link
Contributor Author

@pickfire pickfire Jun 22, 2021

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)?),
Copy link
Contributor Author

@pickfire pickfire Jun 22, 2021

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.

@archseer archseer mentioned this pull request Jun 23, 2021
Closed
Need to be used for autoinfo

Revert "Revert "Refactor key into helix-view""

This reverts commit 10f9f72.
@archseer archseer merged commit 10548bf into helix-editor:master Jun 24, 2021
@pickfire pickfire deleted the revert-config branch June 24, 2021 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants