on master help sign in
Update auto-pairs and idle-timeout when the config is reloaded (#2736)
794576aBjorn Ove Hay Andersen
helix-term/src/application.rs+5
@@ -287,6 +287,10 @@ impl Application {
287 self.config.store(Arc::new(app_config));
287 self.config.store(Arc::new(app_config));
288 }
288 }
289 }
289 }
290+
291+ // Update all the relevant members in the editor after updating
292+ // the configuration.
293+ self.editor.refresh_config();
290 }
294 }
291
295
292 fn refresh_config(&mut self) {
296 fn refresh_config(&mut self) {
@@ -316,6 +320,7 @@ impl Application {
316 }),
320 }),
317 );
321 );
318 }
322 }
323+
319 self.config.store(Arc::new(config));
324 self.config.store(Arc::new(config));
320 }
325 }
321
326
helix-view/src/editor.rs+8
@@ -535,6 +535,14 @@ impl Editor {
535 self.config.load()
535 self.config.load()
536 }
536 }
537
537
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+
538 pub fn clear_idle_timer(&mut self) {
546 pub fn clear_idle_timer(&mut self) {
539 // equivalent to internal Instant::far_future() (30 years)
547 // equivalent to internal Instant::far_future() (30 years)
540 self.idle_timer
548 self.idle_timer