1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-25 14:22:37 +03:00

use PtySize in Tab::resize interface

This commit is contained in:
Wez Furlong 2019-06-09 06:53:24 -07:00
parent c8ad858a29
commit 92917a3a66
3 changed files with 11 additions and 22 deletions

View File

@ -47,22 +47,11 @@ impl Tab for LocalTab {
.key_down(key, mods, &mut *self.pty.borrow_mut())
}
fn resize(
&self,
rows: u16,
cols: u16,
pixel_width: u16,
pixel_height: u16,
) -> Result<(), Error> {
self.pty.borrow_mut().resize(PtySize {
rows,
cols,
pixel_width,
pixel_height,
})?;
fn resize(&self, size: PtySize) -> Result<(), Error> {
self.pty.borrow_mut().resize(size)?;
self.terminal
.borrow_mut()
.resize(rows as usize, cols as usize);
.resize(size.rows as usize, size.cols as usize);
Ok(())
}

View File

@ -235,7 +235,12 @@ pub trait TerminalWindow {
.get_window(self.get_mux_window_id())
.ok_or_else(|| format_err!("no such window!?"))?;
for tab in window.iter() {
tab.resize(rows, cols, width as u16, height as u16)?;
tab.resize(PtySize {
rows,
cols,
pixel_width: width as u16,
pixel_height: height as u16,
})?;
}
Ok(true)

View File

@ -1,6 +1,7 @@
use crate::mux::domain::DomainId;
use crate::mux::renderable::Renderable;
use failure::Error;
use portable_pty::PtySize;
use std::cell::RefMut;
use term::color::ColorPalette;
use term::{KeyCode, KeyModifiers, MouseEvent, TerminalHost};
@ -19,13 +20,7 @@ pub trait Tab {
fn send_paste(&self, text: &str) -> Result<(), Error>;
fn reader(&self) -> Result<Box<dyn std::io::Read + Send>, Error>;
fn writer(&self) -> RefMut<dyn std::io::Write>;
fn resize(
&self,
rows: u16,
cols: u16,
pixel_width: u16,
pixel_height: u16,
) -> Result<(), Error>;
fn resize(&self, size: PtySize) -> Result<(), Error>;
fn key_down(&self, key: KeyCode, mods: KeyModifiers) -> Result<(), Error>;
fn mouse_event(&self, event: MouseEvent, host: &mut dyn TerminalHost) -> Result<(), Error>;
fn advance_bytes(&self, buf: &[u8], host: &mut dyn TerminalHost);