Update auto-pairs and idle-timeout when the config is reloaded (#2736)
commit794576a5b0b9a7b9e59275acd47448525de1aac1
authorBjorn Ove Hay Andersen <bjrnove@gmail.com>
dateWed 15 Jun 2022, 19:29 (4 years ago)
parent11dadab
helix-term/src/application.rs+5
@@ -287,6 +287,10 @@ impl Application {
287287 self.config.store(Arc::new(app_config));
288288 }
289289 }
290+
291+ // Update all the relevant members in the editor after updating
292+ // the configuration.
293+ self.editor.refresh_config();
290294 }
291295
292296 fn refresh_config(&mut self) {
@@ -316,6 +320,7 @@ impl Application {
316320 }),
317321 );
318322 }
323+
319324 self.config.store(Arc::new(config));
320325 }
321326
helix-view/src/editor.rs+8
@@ -535,6 +535,14 @@ impl Editor {
535535 self.config.load()
536536 }
537537
538+ /// Call if the config has changed to let the editor update all
539+ /// relevant members.
540+ pub fn refresh_config(&mut self) {
541+ let config = self.config();
542+ self.auto_pairs = (&config.auto_pairs).into();
543+ self.reset_idle_timer();
544+ }
545+
538546 pub fn clear_idle_timer(&mut self) {
539547 // equivalent to internal Instant::far_future() (30 years)
540548 self.idle_timer