Merge pull request #858 from dcousens/fix-min-width

Fix minimum widths for Shrink and Expand
This commit is contained in:
Tony Zorman 2023-12-23 08:07:57 +01:00 committed by GitHub
commit 5ceaed8126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -56,8 +56,8 @@ instance LayoutClass TwoPane a where
handleMessage (TwoPane delta split) x =
return $ case fromMessage x of
Just Shrink -> Just (TwoPane delta (split - delta))
Just Expand -> Just (TwoPane delta (split + delta))
Just Shrink -> Just (TwoPane delta (max 0 (split - delta)))
Just Expand -> Just (TwoPane delta (min 1 (split + delta)))
_ -> Nothing
description _ = "TwoPane"

View File

@ -58,8 +58,8 @@ instance (Show a, Eq a) => LayoutClass TwoPanePersistent a where
pureMessage (TwoPanePersistent w delta split) x =
case fromMessage x of
Just Shrink -> Just (TwoPanePersistent w delta (split - delta))
Just Expand -> Just (TwoPanePersistent w delta (split + delta))
Just Shrink -> Just (TwoPanePersistent w delta (max 0 (split - delta)))
Just Expand -> Just (TwoPanePersistent w delta (min 1 (split + delta)))
_ -> Nothing
description _ = "TwoPanePersistent"