fn resize_if_needed(&mut self, new_size: &Size, logical_size: &Size) -> Result<(), Error> {
        // The shell works on logical size units but the views operate based on the size
        if TerminalViewAssistant::needs_resize(&self.last_known_size, new_size) {
            let floored_size = new_size.floor();
            let term_size = TerminalScene::calculate_term_size_from_size(&floored_size);

            let last_size_info = self.term.size_info();
            let cell_width = last_size_info.cell_width;
            let cell_height = last_size_info.cell_height;
            let padding_x = last_size_info.padding_x;
            let padding_y = last_size_info.padding_y;

            self.term.resize(&SizeInfo {
                width: term_size.width,
                height: term_size.height,
                cell_width,
                cell_height,
                padding_x,
                padding_y,
            });

            self.queue_outgoing_message(PtyOutgoingMessages::Resize(*logical_size))
                .context("unable to queue outgoing pty message")?;

            self.last_known_size = floored_size;
            self.terminal_scene.update_size(floored_size);
            self.terminal_scene.update_cell_size(Size::new(cell_width, cell_height));
        }
        Ok(())
    }
/// Checks to see if the size of terminal has changed and resizes if it has.
Checks to see if the size of terminal has changed and resizes if it has.
Checks to see if the size of terminal has changed and resizes if it has .
fn resize_if_needed(&mut self, new_size: &Size, logical_size: &Size) -> Result<(), Error> {
        // The shell works on logical size units but the views operate based on the size
        if TerminalViewAssistant::needs_resize(&self.last_known_size, new_size) {
            let floored_size = new_size.floor();
            let term_size = TerminalScene::calculate_term_size_from_size(&floored_size);
            let last_size_info = self.term.size_info();
            let cell_width = last_size_info.cell_width;
            let cell_height = last_size_info.cell_height;
            let padding_x = last_size_info.padding_x;
            let padding_y = last_size_info.padding_y;
            self.term.resize(&SizeInfo {
                width: term_size.width,
                height: term_size.height,
                cell_width,
                cell_height,
                padding_x,
                padding_y,
            });
            self.queue_outgoing_message(PtyOutgoingMessages::Resize(*logical_size))
                .context("unable to queue outgoing pty message")?;
            self.last_known_size = floored_size;
            self.terminal_scene.update_size(floored_size);
            self.terminal_scene.update_cell_size(Size::new(cell_width, cell_height));
        }
        Ok(())
    }
fn resize_if_needed ( & mut self , new_size : & Size , logical_size : & Size ) -> Result < ( ) , Error > { // The shell works on logical size units but the views operate based on the size if TerminalViewAssistant :: needs_resize ( & self . last_known_size , new_size ) { let floored_size = new_size . floor ( ) ; let term_size = TerminalScene :: calculate_term_size_from_size ( & floored_size ) ; let last_size_info = self . term . size_info ( ) ; let cell_width = last_size_info . cell_width ; let cell_height = last_size_info . cell_height ; let padding_x = last_size_info . padding_x ; let padding_y = last_size_info . padding_y ; self . term . resize ( & SizeInfo { width : term_size . width , height : term_size . height , cell_width , cell_height , padding_x , padding_y , } ) ; self . queue_outgoing_message ( PtyOutgoingMessages :: Resize ( * logical_size ) ) . context ( " " ) ? ; self . last_known_size = floored_size ; self . terminal_scene . update_size ( floored_size ) ; self . terminal_scene . update_cell_size ( Size :: new ( cell_width , cell_height ) ) ; } Ok ( ( ) ) }
Checks to see if the size of terminal has changed and resizes if it has.
Checks to see if the size of terminal has changed and resizes if it has .
&mut self
new_size
&Size
logical_size
&Size