1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00

splitting writer out of Tab::pty()

This commit is contained in:
Wez Furlong 2019-03-02 11:27:11 -08:00
parent 0c3410fb6a
commit 6c8a9e999e
4 changed files with 9 additions and 32 deletions

View File

@ -635,14 +635,9 @@ impl GliumTerminalWindow {
return Ok(());
}
tab.terminal().key_down(key, mods, &mut *tab.pty())?
tab.terminal().key_down(key, mods, &mut *tab.writer())?
}
ElementState::Released => tab.terminal().key_up(
key,
mods,
&mut TabHost::new(&mut tab.pty(), &mut self.host),
)?,
ElementState::Released => {}
}
} else {
eprintln!("event {:?} with no mapping", event);
@ -695,7 +690,7 @@ impl GliumTerminalWindow {
tab.terminal().key_down(
KeyCode::Char(c),
self.last_modifiers,
&mut *tab.pty(),
&mut *tab.writer(),
)?;
self.paint_if_needed()?;
}

View File

@ -37,9 +37,14 @@ impl Tab {
self.process.borrow_mut()
}
#[deprecated(note = "use writer or something else")]
pub fn pty(&self) -> RefMut<MasterPty> {
self.pty.borrow_mut()
}
pub fn writer(&self) -> RefMut<MasterPty> {
self.pty.borrow_mut()
}
}
impl Drop for Tab {

View File

@ -241,21 +241,7 @@ impl X11TerminalWindow {
return Ok(());
}
tab.terminal().key_down(code, mods, &mut *tab.pty())?;
}
}
xcb::KEY_RELEASE => {
let key_press: &xcb::KeyPressEvent = unsafe { xcb::cast_event(event) };
if let Some((code, mods)) = self.decode_key(key_press) {
let tab = match self.tabs.get_active() {
Some(tab) => tab,
None => return Ok(()),
};
tab.terminal().key_up(
code,
mods,
&mut TabHost::new(&mut tab.pty(), &mut self.host),
)?;
tab.terminal().key_down(code, mods, &mut *tab.writer())?;
}
}
xcb::MOTION_NOTIFY => {

View File

@ -910,15 +910,6 @@ impl TerminalState {
Ok(())
}
pub fn key_up(
&mut self,
_: KeyCode,
_: KeyModifiers,
_: &mut TerminalHost,
) -> Result<(), Error> {
Ok(())
}
pub fn resize(&mut self, physical_rows: usize, physical_cols: usize) {
self.screen.resize(physical_rows, physical_cols);
self.scroll_region = 0..physical_rows as i64;