aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrooks Rady <b.j.rady@gmail.com>2021-08-31 16:42:34 +0100
committerGitHub <noreply@github.com>2021-08-31 16:42:34 +0100
commit18dca848e6c4d59bc7c672a0863158daf8182ef2 (patch)
tree690247fbdf5395cc02e402c8ea5bcb2c891f6995
parentchore(assets): update demo gif (#681) (diff)
downloadsl0ppij-18dca848e6c4d59bc7c672a0863158daf8182ef2.tar.gz
sl0ppij-18dca848e6c4d59bc7c672a0863158daf8182ef2.tar.xz
sl0ppij-18dca848e6c4d59bc7c672a0863158daf8182ef2.zip
fix(ui): offset content after viewport construction
-rw-r--r--zellij-server/src/tab.rs5
-rw-r--r--zellij-server/src/ui/pane_resizer.rs16
2 files changed, 5 insertions, 16 deletions
diff --git a/zellij-server/src/tab.rs b/zellij-server/src/tab.rs
index 2f646574..16e196a1 100644
--- a/zellij-server/src/tab.rs
+++ b/zellij-server/src/tab.rs
@@ -385,6 +385,7 @@ impl Tab {
for geom in boundary_geom {
self.offset_viewport(&geom)
}
+ self.set_pane_frames(self.draw_pane_frames);
// This is the end of the nasty viewport hack...
// FIXME: Active / new / current terminal, should be pane
self.active_terminal = self.panes.iter().map(|(id, _)| id.to_owned()).next();
@@ -1642,7 +1643,7 @@ impl Tab {
})
}
pub fn relayout_tab(&mut self, direction: Direction) {
- let mut resizer = PaneResizer::new(&mut self.panes.iter_mut(), &mut self.os_api);
+ let mut resizer = PaneResizer::new(self.panes.iter_mut());
let result = match direction {
Direction::Horizontal => resizer.layout(direction, self.display_area.cols),
Direction::Vertical => resizer.layout(direction, self.display_area.rows),
@@ -1662,7 +1663,7 @@ impl Tab {
.iter_mut()
.filter(|(pid, _)| !temp_panes_to_hide.contains(pid));
let Size { rows, cols } = new_screen_size;
- let mut resizer = PaneResizer::new(panes, &mut self.os_api);
+ let mut resizer = PaneResizer::new(panes);
if resizer.layout(Direction::Horizontal, cols).is_ok() {
let column_difference = cols as isize - self.display_area.cols as isize;
// FIXME: Should the viewport be an Offset?
diff --git a/zellij-server/src/ui/pane_resizer.rs b/zellij-server/src/ui/pane_resizer.rs
index 0213f6d5..76153597 100644
--- a/zellij-server/src/ui/pane_resizer.rs
+++ b/zellij-server/src/ui/pane_resizer.rs
@@ -1,4 +1,4 @@
-use crate::{os_input_output::ServerOsApi, panes::PaneId, tab::Pane};
+use crate::{panes::PaneId, tab::Pane};
use cassowary::{
strength::{REQUIRED, STRONG},
Expression, Solver, Variable,
@@ -12,7 +12,6 @@ use zellij_utils::{
pub struct PaneResizer<'a> {
panes: HashMap<&'a PaneId, &'a mut Box<dyn Pane>>,
- os_api: &'a mut Box<dyn ServerOsApi>,
vars: HashMap<PaneId, Variable>,
solver: Solver,
}
@@ -31,10 +30,7 @@ struct Span {
type Grid = Vec<Vec<Span>>;
impl<'a> PaneResizer<'a> {
- pub fn new(
- panes: impl Iterator<Item = (&'a PaneId, &'a mut Box<dyn Pane>)>,
- os_api: &'a mut Box<dyn ServerOsApi>,
- ) -> Self {
+ pub fn new(panes: impl Iterator<Item = (&'a PaneId, &'a mut Box<dyn Pane>)>) -> Self {
let panes: HashMap<_, _> = panes.collect();
let mut vars = HashMap::new();
for &&k in panes.keys() {
@@ -42,7 +38,6 @@ impl<'a> PaneResizer<'a> {
}
PaneResizer {
panes,
- os_api,
vars,
solver: Solver::new(),
}
@@ -146,13 +141,6 @@ impl<'a> PaneResizer<'a> {
} else {
pane.set_geom(new_geom);
}
- if let PaneId::Terminal(pid) = pane.pid() {
- self.os_api.set_terminal_size_using_fd(
- pid,
- pane.get_content_columns() as u16,
- pane.get_content_rows() as u16,
- );
- }
}
}