mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 06:54:45 +03:00
fix reloading the global config when the appearance changes
We didn't actually update the global config, just the per-window configs, which led to weird stale throwbacks to earlier versions of the config when spawning windows or new panes. Fix that up by explicitly reloading the global config when the window appearance is changed. That isn't ideal as we will reload once per window, but it's "OK". While poking at this, I noticed that the get/set config methods on the termwiztermtab overlay weren't hooked up, and also made a point of calling those for any overlays during a window config reload event, so that per-window overrides are more likely to get picked up and respected. refs: https://github.com/wez/wezterm/issues/2295
This commit is contained in:
parent
bd79ee0bff
commit
355f3d3975
@ -29,7 +29,9 @@ use termwiz::terminal::{ScreenSize, TerminalWaker};
|
||||
use termwiz::Context;
|
||||
use url::Url;
|
||||
use wezterm_term::color::ColorPalette;
|
||||
use wezterm_term::{KeyCode, KeyModifiers, MouseEvent, StableRowIndex, TerminalSize};
|
||||
use wezterm_term::{
|
||||
KeyCode, KeyModifiers, MouseEvent, StableRowIndex, TerminalConfiguration, TerminalSize,
|
||||
};
|
||||
|
||||
struct TermWizTerminalDomain {
|
||||
domain_id: DomainId,
|
||||
@ -217,6 +219,14 @@ impl Pane for TermWizTerminalPane {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_config(&self, config: Arc<dyn TerminalConfiguration>) {
|
||||
self.terminal.borrow_mut().set_config(config);
|
||||
}
|
||||
|
||||
fn get_config(&self) -> Option<Arc<dyn TerminalConfiguration>> {
|
||||
Some(self.terminal.borrow().get_config())
|
||||
}
|
||||
|
||||
fn perform_actions(&self, actions: Vec<termwiz::escape::Action>) {
|
||||
self.terminal.borrow_mut().perform_actions(actions)
|
||||
}
|
||||
|
@ -792,6 +792,17 @@ impl TermWindow {
|
||||
}
|
||||
WindowEvent::AppearanceChanged(appearance) => {
|
||||
log::debug!("Appearance is now {:?}", appearance);
|
||||
// This is a bit fugly; we get per-window notifications
|
||||
// for appearance changes which successfully updates the
|
||||
// per-window config, but we need to explicitly tell the
|
||||
// global config to reload, otherwise things that acces
|
||||
// the config via config::configuration() will see the
|
||||
// prior version of the config.
|
||||
// What's fugly about this is that we'll reload the
|
||||
// global config here once per window, which could
|
||||
// be nasty for folks with a lot of windows.
|
||||
// <https://github.com/wez/wezterm/issues/2295>
|
||||
config::reload();
|
||||
self.config_was_reloaded();
|
||||
Ok(true)
|
||||
}
|
||||
@ -1454,7 +1465,17 @@ impl TermWindow {
|
||||
pane.pane.set_config(Arc::clone(&term_config));
|
||||
}
|
||||
}
|
||||
};
|
||||
for state in self.pane_state.borrow().values() {
|
||||
if let Some(overlay) = &state.overlay {
|
||||
overlay.pane.set_config(Arc::clone(&term_config));
|
||||
}
|
||||
}
|
||||
for state in self.tab_state.borrow().values() {
|
||||
if let Some(overlay) = &state.overlay {
|
||||
overlay.pane.set_config(Arc::clone(&term_config));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(window) = self.window.as_ref().map(|w| w.clone()) {
|
||||
self.load_os_parameters();
|
||||
|
Loading…
Reference in New Issue
Block a user