| Scenario | Screenshot | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | short patch | <img width="1096" height="533" alt="short patch" src="https://github.com/user-attachments/assets/8a883429-0965-4c0b-9002-217b3759b557" /> | | short command | <img width="1096" height="533" alt="short command" src="https://github.com/user-attachments/assets/901abde8-2494-4e86-b98a-7cabaf87ca9c" /> | | long patch | <img width="1129" height="892" alt="long patch" src="https://github.com/user-attachments/assets/fa799a29-a0d6-48e6-b2ef-10302a7916d3" /> | | long command | <img width="1096" height="892" alt="long command" src="https://github.com/user-attachments/assets/11ddf79b-98cb-4b60-ac22-49dfa7779343" /> | | viewing complete patch | <img width="1129" height="892" alt="viewing complete patch" src="https://github.com/user-attachments/assets/81666958-af94-420e-aa66-b60d0a42b9db" /> |
48 lines
907 B
Rust
48 lines
907 B
Rust
use ratatui::layout::Rect;
|
|
|
|
pub mod highlight;
|
|
pub mod line_utils;
|
|
pub mod renderable;
|
|
|
|
pub struct Insets {
|
|
pub left: u16,
|
|
pub top: u16,
|
|
pub right: u16,
|
|
pub bottom: u16,
|
|
}
|
|
|
|
impl Insets {
|
|
pub fn tlbr(top: u16, left: u16, bottom: u16, right: u16) -> Self {
|
|
Self {
|
|
top,
|
|
left,
|
|
bottom,
|
|
right,
|
|
}
|
|
}
|
|
|
|
pub fn vh(v: u16, h: u16) -> Self {
|
|
Self {
|
|
top: v,
|
|
left: h,
|
|
bottom: v,
|
|
right: h,
|
|
}
|
|
}
|
|
}
|
|
|
|
pub trait RectExt {
|
|
fn inset(&self, insets: Insets) -> Rect;
|
|
}
|
|
|
|
impl RectExt for Rect {
|
|
fn inset(&self, insets: Insets) -> Rect {
|
|
Rect {
|
|
x: self.x + insets.left,
|
|
y: self.y + insets.top,
|
|
width: self.width - insets.left - insets.right,
|
|
height: self.height - insets.top - insets.bottom,
|
|
}
|
|
}
|
|
}
|