Skip to content

Commit

Permalink
patchy: auto-merge pull request helix-editor#12311
Browse files Browse the repository at this point in the history
`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
  • Loading branch information
nik-rev committed Jan 7, 2025
2 parents 3035297 + 09685a0 commit 3d0d162
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion helix-term/src/ui/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use tui::buffer::Buffer;

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

pub const FULL_OVERLAID_MAX_WIDTH: u16 = 240;

/// Contains a component placed in the center of the parent component
pub struct Overlay<T> {
/// Child component
Expand All @@ -19,7 +21,14 @@ pub struct Overlay<T> {
pub fn overlaid<T>(content: T) -> Overlay<T> {
Overlay {
content,
calc_child_size: Box::new(|rect: Rect| clip_rect_relative(rect.clip_bottom(2), 90, 90)),
calc_child_size: Box::new(|rect: Rect| {
let percentage = if rect.width < FULL_OVERLAID_MAX_WIDTH {
100
} else {
90
};
clip_rect_relative(rect.clip_bottom(2), percentage, percentage)
}),
}
}

Expand Down

0 comments on commit 3d0d162

Please sign in to comment.