MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / draw_confirm_popup

Function draw_confirm_popup

crates/openshell-tui/src/ui/mod.rs:641–658  ·  view source on GitHub ↗

Render a bordered confirmation popup centred on `area`. `lines` is the popup body; height is derived from the line count. Use `t.border_focused` for confirmations and `t.status_err` for destructive actions.

(
    frame: &mut Frame<'_>,
    lines: Vec<Line<'_>>,
    border_style: Style,
    width: u16,
    area: Rect,
)

Source from the content-addressed store, hash-verified

639/// Use `t.border_focused` for confirmations and `t.status_err` for destructive
640/// actions.
641fn draw_confirm_popup(
642 frame: &mut Frame<'_>,
643 lines: Vec<Line<'_>>,
644 border_style: Style,
645 width: u16,
646 area: Rect,
647) {
648 let popup_height = u16::try_from(lines.len() + 2).unwrap_or(u16::MAX);
649 let popup = centered_popup(width, popup_height, area);
650 frame.render_widget(Clear, popup);
651
652 let block = Block::default()
653 .borders(Borders::ALL)
654 .border_style(border_style)
655 .padding(Padding::horizontal(1));
656
657 frame.render_widget(Paragraph::new(lines).block(block), popup);
658}
659
660/// Center a popup rectangle within `area` using percentage-based width and
661/// an absolute height (in rows).

Callers 4

draw_confirm_setFunction · 0.85
draw_confirm_deleteFunction · 0.85
draw_confirm_setFunction · 0.85
draw_confirm_deleteFunction · 0.85

Calls 2

centered_popupFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected