MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / inset_rect

Function inset_rect

crates/opencode-tui/src/components/dialogs/mod.rs:49–66  ·  view source on GitHub ↗
(area: Rect, padding_x: u16, padding_y: u16)

Source from the content-addressed store, hash-verified

47}
48
49fn inset_rect(area: Rect, padding_x: u16, padding_y: u16) -> Rect {
50 if area.width == 0 || area.height == 0 {
51 return area;
52 }
53
54 let twice_x = padding_x.saturating_mul(2);
55 let twice_y = padding_y.saturating_mul(2);
56 if area.width <= twice_x || area.height <= twice_y {
57 return area;
58 }
59
60 Rect {
61 x: area.x.saturating_add(padding_x),
62 y: area.y.saturating_add(padding_y),
63 width: area.width.saturating_sub(twice_x),
64 height: area.height.saturating_sub(twice_y),
65 }
66}
67
68pub use agent_select::{Agent, AgentSelectDialog};
69pub use alert::AlertDialog;

Callers 2

centered_rectFunction · 0.85
dialog_innerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected