fn draw_output_panel(
    frame: &mut Frame<CrosstermBackend<Stdout>>,
    state: &mut OutputState,
    chunk: Rect,
) {
    let output_logs: String = state.output.iter().map(|h| format!(" {}\n", h)).collect();

    // Autoscroll if output overflows chunk height, adjusting for manual scroll with output_cursor
    let output_length = state.output.len() as u16;
    let output_cursor = state.output_cursor as u16;
    state.output_scroll = if output_length >= chunk.height - 3 {
        if output_cursor >= chunk.height {
            output_cursor as u16 + 1 - chunk.height
        } else {
            0
        }
    } else {
        0
    };
    state.output_width = chunk.width as usize;

    // Draw REPL panel
    let output_panel = Paragraph::new(output_logs)
        .block(Block::default().borders(Borders::ALL).title(Span::styled(
            " OUTPUT (SHIFT+UP/DOWN to scroll) ",
            Style::default().add_modifier(Modifier::BOLD),
        )))
        .style(Style::default().fg(Color::White))
        .alignment(Alignment::Left)
        .scroll((state.output_scroll, 0))
        .wrap(Wrap { trim: false });
    frame.render_widget(output_panel, chunk);
}
/// Display command output in the provided panel
Display command output in the provided panel
Display command output in the provided panel
fn draw_output_panel(
    frame: &mut Frame<CrosstermBackend<Stdout>>,
    state: &mut OutputState,
    chunk: Rect,
) {
    let output_logs: String = state.output.iter().map(|h| format!(" {}\n", h)).collect();
    // Autoscroll if output overflows chunk height, adjusting for manual scroll with output_cursor
    let output_length = state.output.len() as u16;
    let output_cursor = state.output_cursor as u16;
    state.output_scroll = if output_length >= chunk.height - 3 {
        if output_cursor >= chunk.height {
            output_cursor as u16 + 1 - chunk.height
        } else {
            0
        }
    } else {
        0
    };
    state.output_width = chunk.width as usize;
    // Draw REPL panel
    let output_panel = Paragraph::new(output_logs)
        .block(Block::default().borders(Borders::ALL).title(Span::styled(
            " OUTPUT (SHIFT+UP/DOWN to scroll) ",
            Style::default().add_modifier(Modifier::BOLD),
        )))
        .style(Style::default().fg(Color::White))
        .alignment(Alignment::Left)
        .scroll((state.output_scroll, 0))
        .wrap(Wrap { trim: false });
    frame.render_widget(output_panel, chunk);
}
fn draw_output_panel ( frame : & mut Frame < CrosstermBackend < Stdout > > , state : & mut OutputState , chunk : Rect , ) { let output_logs : String = state . output . iter ( ) . map ( | h | format ! ( " \n " h ) ) . collect ( ) ; // Autoscroll if output overflows chunk height, adjusting for manual scroll with output_cursor let output_length = state . output . len ( ) as u16 ; let output_cursor = state . output_cursor as u16 ; state . output_scroll = if output_length >= chunk . height - 3 { if output_cursor >= chunk . height { output_cursor as u16 + 1 - chunk . height } else { 0 } } else { 0 } ; state . output_width = chunk . width as usize ; // Draw REPL panel let output_panel = Paragraph :: new ( output_logs ) . block ( Block :: default ( ) . borders ( Borders :: ALL ) . title ( Span :: styled ( " " , Style :: default ( ) . add_modifier ( Modifier :: BOLD ) , ) ) ) . style ( Style :: default ( ) . fg ( Color :: White ) ) . alignment ( Alignment :: Left ) . scroll ( ( state . output_scroll , 0 ) ) . wrap ( Wrap { trim : false } ) ; frame . render_widget ( output_panel , chunk ) ; }
Display command output in the provided panel
Display command output in the provided panel
frame
&mut Frame<CrosstermBackend<Stdout>>
state
&mut OutputState
chunk
Rect
frame
&mut Frame<CrosstermBackend<Stdout>>
state
&mut OutputState
chunk
Rect