1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-19 18:57:59 +03:00

overlays: pass down window config and apply overrides

refs: https://github.com/wez/wezterm/issues/2544
This commit is contained in:
Wez Furlong 2022-09-23 05:00:31 -07:00
parent c839aeb431
commit 8e7a2cce79
4 changed files with 23 additions and 8 deletions

View File

@ -59,6 +59,8 @@ As features stabilize some brief notes about them will accumulate here.
* Cells with the invisible/hidden attribute are now invisible
* Panic when trying to activate the search overlay when the launcher menu is
active [#2529](https://github.com/wez/wezterm/issues/2529)
* Overlays did not see config overrides set via `window:set_config_overrides`
[#2544](https://github.com/wez/wezterm/issues/2544)
#### Changed
* Removed Last Resort fallback font

View File

@ -273,6 +273,7 @@ impl ConnectionUI {
}
Ok(())
},
None,
))
.detach();
Self { tx }

View File

@ -97,12 +97,13 @@ impl TermWizTerminalPane {
size: TerminalSize,
input_tx: Sender<InputEvent>,
render_rx: FileDescriptor,
term_config: Option<Arc<dyn TerminalConfiguration + Send + Sync>>,
) -> Self {
let pane_id = alloc_pane_id();
let terminal = RefCell::new(wezterm_term::Terminal::new(
size,
std::sync::Arc::new(config::TermConfig::new()),
term_config.unwrap_or_else(|| Arc::new(config::TermConfig::new())),
"WezTerm",
config::wezterm_version(),
Box::new(Vec::new()), // FIXME: connect to something?
@ -431,7 +432,10 @@ impl termwiz::terminal::Terminal for TermWizTerminal {
}
}
pub fn allocate(size: TerminalSize) -> (TermWizTerminal, Rc<dyn Pane>) {
pub fn allocate(
size: TerminalSize,
config: Arc<dyn TerminalConfiguration + Send + Sync>,
) -> (TermWizTerminal, Rc<dyn Pane>) {
let render_pipe = Pipe::new().expect("Pipe creation not to fail");
let (input_tx, input_rx) = channel();
@ -454,7 +458,7 @@ pub fn allocate(size: TerminalSize) -> (TermWizTerminal, Rc<dyn Pane>) {
};
let domain_id = 0;
let pane = TermWizTerminalPane::new(domain_id, size, input_tx, render_pipe.read);
let pane = TermWizTerminalPane::new(domain_id, size, input_tx, render_pipe.read, Some(config));
// Add the tab to the mux so that the output is processed
let pane: Rc<dyn Pane> = Rc::new(pane);
@ -478,6 +482,7 @@ pub async fn run<
size: TerminalSize,
window_id: Option<WindowId>,
f: F,
term_config: Option<Arc<dyn TerminalConfiguration + Send + Sync>>,
) -> anyhow::Result<T> {
let render_pipe = Pipe::new().expect("Pipe creation not to fail");
let render_rx = render_pipe.read;
@ -506,6 +511,7 @@ pub async fn run<
render_rx: FileDescriptor,
size: TerminalSize,
window_id: Option<WindowId>,
term_config: Option<Arc<dyn TerminalConfiguration + Send + Sync>>,
) -> anyhow::Result<(PaneId, WindowId)> {
let mux = Mux::get().unwrap();
@ -522,7 +528,8 @@ pub async fn run<
}
};
let pane = TermWizTerminalPane::new(domain.domain_id(), size, input_tx, render_rx);
let pane =
TermWizTerminalPane::new(domain.domain_id(), size, input_tx, render_rx, term_config);
let pane: Rc<dyn Pane> = Rc::new(pane);
let tab = Rc::new(Tab::new(&size));
@ -541,7 +548,7 @@ pub async fn run<
}
let (pane_id, window_id) = promise::spawn::spawn_into_main_thread(async move {
register_tab(input_tx, render_rx, size, window_id).await
register_tab(input_tx, render_rx, size, window_id, term_config).await
})
.await?;

View File

@ -4,7 +4,8 @@ use mux::tab::{Tab, TabId};
use mux::termwiztermtab::{allocate, TermWizTerminal};
use std::pin::Pin;
use std::rc::Rc;
use wezterm_term::TerminalSize;
use std::sync::Arc;
use wezterm_term::{TerminalConfiguration, TerminalSize};
pub mod confirm_close_pane;
pub mod copy;
@ -34,7 +35,9 @@ where
{
let tab_id = tab.tab_id();
let tab_size = tab.get_size();
let (tw_term, tw_tab) = allocate(tab_size);
let term_config: Arc<dyn TerminalConfiguration + Send + Sync> =
Arc::new(config::TermConfig::with_config(term_window.config.clone()));
let (tw_term, tw_tab) = allocate(tab_size, term_config);
let window = term_window.window.clone().unwrap();
@ -70,7 +73,9 @@ where
pixel_height: term_window.render_metrics.cell_size.height as usize * dims.viewport_rows,
dpi: dims.dpi,
};
let (tw_term, tw_tab) = allocate(size);
let term_config: Arc<dyn TerminalConfiguration + Send + Sync> =
Arc::new(config::TermConfig::with_config(term_window.config.clone()));
let (tw_term, tw_tab) = allocate(size, term_config);
let window = term_window.window.clone().unwrap();