diff --git a/CHANGELOG.md b/CHANGELOG.md index 325ea11c..a543bcf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- fix crash help in small window size ([#63](https://github.com/extrawurst/gitui/issues/63)) + ## [0.2.5] - 2020-05-16 ### Added - introduced proper changelog diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 2ec7f4f3..b8e241f3 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -47,10 +47,10 @@ pub fn centered_rect_absolute( r: Rect, ) -> Rect { Rect::new( - (r.width - width) / 2, - (r.height - height) / 2, - width, - height, + (r.width.saturating_sub(width)) / 2, + (r.height.saturating_sub(height)) / 2, + width.min(r.width), + height.min(r.height), ) }