Skip to content

Commit

Permalink
Update auto-pairs and idle-timeout when the config is reloaded (#2736)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn-ove authored Jun 15, 2022
1 parent 11dadab commit 794576a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ impl Application {
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) {
Expand Down Expand Up @@ -316,6 +320,7 @@ impl Application {
}),
);
}

self.config.store(Arc::new(config));
}

Expand Down
8 changes: 8 additions & 0 deletions helix-view/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,14 @@ impl Editor {
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) {
// equivalent to internal Instant::far_future() (30 years)
self.idle_timer
Expand Down

0 comments on commit 794576a

Please sign in to comment.