summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/input/layout.rs
diff options
context:
space:
mode:
Diffstat (limited to 'zellij-utils/src/input/layout.rs')
-rw-r--r--zellij-utils/src/input/layout.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs
index b041412e2..e283b4455 100644
--- a/zellij-utils/src/input/layout.rs
+++ b/zellij-utils/src/input/layout.rs
@@ -575,7 +575,11 @@ impl FromStr for SplitSize {
if s.chars().last() == Some('%') {
let char_count = s.chars().count();
let percent_size = usize::from_str_radix(&s[..char_count.saturating_sub(1)], 10)?;
- Ok(SplitSize::Percent(percent_size))
+ if percent_size > 0 && percent_size <= 100 {
+ Ok(SplitSize::Percent(percent_size))
+ } else {
+ Err("Percent must be between 0 and 100".into())
+ }
} else {
let fixed_size = usize::from_str_radix(s, 10)?;
Ok(SplitSize::Fixed(fixed_size))