Update auto-pairs and idle-timeout when the config is reloaded (#2736)
This commit is contained in:
parent
11dadab371
commit
794576a5b0
@ -287,6 +287,10 @@ pub fn handle_config_events(&mut self, config_event: ConfigEvent) {
|
|||||||
self.config.store(Arc::new(app_config));
|
self.config.store(Arc::new(app_config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update all the relevant members in the editor after updating
|
||||||
|
// the configuration.
|
||||||
|
self.editor.refresh_config();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn refresh_config(&mut self) {
|
fn refresh_config(&mut self) {
|
||||||
@ -316,6 +320,7 @@ fn refresh_config(&mut self) {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.config.store(Arc::new(config));
|
self.config.store(Arc::new(config));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,6 +535,14 @@ pub fn config(&self) -> DynGuard<Config> {
|
|||||||
self.config.load()
|
self.config.load()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Call if the config has changed to let the editor update all
|
||||||
|
/// relevant members.
|
||||||
|
pub fn refresh_config(&mut self) {
|
||||||
|
let config = self.config();
|
||||||
|
self.auto_pairs = (&config.auto_pairs).into();
|
||||||
|
self.reset_idle_timer();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn clear_idle_timer(&mut self) {
|
pub fn clear_idle_timer(&mut self) {
|
||||||
// equivalent to internal Instant::far_future() (30 years)
|
// equivalent to internal Instant::far_future() (30 years)
|
||||||
self.idle_timer
|
self.idle_timer
|
||||||
|
Loading…
Reference in New Issue
Block a user