mirror of
https://github.com/zellij-org/zellij.git
synced 2024-12-18 06:32:09 +03:00
fix(ui): offset content after viewport construction
This commit is contained in:
parent
a51f500c17
commit
152315f110
@ -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?
|
||||
|
@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user