Skip to content

Commit 014dd0d

Browse files
committed
patchy: auto-merge pull request helix-editor#12311
`patchy` is a tool which makes it easy to declaratively manage personal forks by automatically merging pull requests. Check it out here: https://github.com/NikitaRevenco/patchy
2 parents ce01f97 + 09685a0 commit 014dd0d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

helix-term/src/ui/overlay.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use tui::buffer::Buffer;
77

88
use crate::compositor::{Component, Context, Event, EventResult};
99

10+
pub const FULL_OVERLAID_MAX_WIDTH: u16 = 240;
11+
1012
/// Contains a component placed in the center of the parent component
1113
pub struct Overlay<T> {
1214
/// Child component
@@ -19,7 +21,14 @@ pub struct Overlay<T> {
1921
pub fn overlaid<T>(content: T) -> Overlay<T> {
2022
Overlay {
2123
content,
22-
calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(2), 90, 90)),
24+
calc_child_size: Box::new(|rect: Rect| {
25+
let percentage = if rect.width < FULL_OVERLAID_MAX_WIDTH {
26+
100
27+
} else {
28+
90
29+
};
30+
clip_rect_relative(rect.clip_bottom(2), percentage, percentage)
31+
}),
2332
}
2433
}
2534

0 commit comments

Comments
 (0)