summaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2022-12-19 12:48:43 +0100
committerGitHub <noreply@github.com>2022-12-19 12:48:43 +0100
commit1b5f3c52a48feb584228f326c20829c83c21cc47 (patch)
treef4a76f6ecb2e3fca72c83899ba2c1cd83acbfe02 /zellij-utils/src
parentd1f50150f6f7525f93ccb9ed94f75ce6bfb5c60b (diff)
fix(panes): show visual error when failing to resize panes (#2036)
* fix(panes): show visual error when failing to resize pane vertically/horizontally * fix(resize): retry pane resize on rounding errors * fix(resize): proper error when resizing other panes into fixed panes * style(fmt): rustfmt
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/errors.rs8
-rw-r--r--zellij-utils/src/pane_size.rs4
2 files changed, 12 insertions, 0 deletions
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index 4b7149ecc..d0e4fad25 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -495,6 +495,14 @@ open an issue on GitHub:
source: anyhow::Error,
},
+ // this is a temporary hack until we're able to merge custom errors from within the various
+ // crates themselves without having to move their payload types here
+ #[error("Cannot resize fixed panes")]
+ CantResizeFixedPanes { pane_ids: Vec<(u32, bool)> }, // bool: 0 => terminal_pane, 1 =>
+ // plugin_pane
+ #[error("Pane size remains unchanged")]
+ PaneSizeUnchanged,
+
#[error("an error occured")]
GenericError { source: anyhow::Error },
}
diff --git a/zellij-utils/src/pane_size.rs b/zellij-utils/src/pane_size.rs
index 048ae3d65..66f66ad5a 100644
--- a/zellij-utils/src/pane_size.rs
+++ b/zellij-utils/src/pane_size.rs
@@ -79,6 +79,10 @@ impl Dimension {
}
}
+ pub fn set_percent(&mut self, percent: f64) {
+ self.constraint = Constraint::Percent(percent);
+ }
+
pub fn set_inner(&mut self, inner: usize) {
self.inner = inner;
}