Skip to content

Commit

Permalink
feat(ui): stacked resize (#3957)
Browse files Browse the repository at this point in the history
* work

* tests and initial notes for refactoring

* refactor(stacked-panes): break out pane

* vertical functionality working with a single stack

* refactor: break out pane from stack

* fix: properly support multiple stacks in tab

* combining multiple stacks vertically

* vertical resizing working for all cases

* base functionality and tests

* some UX tweaking

* final functionality for directionless stacked increase

* some cleanups

* moar cleanups

* refactor: stacked resize

* fix: issue where resizing stacked geoms to 0 would cause them to overflow afterwards

* fix: handle uneven stacking

* functionality with tombstones

* new open new pane functionality

* match decrease increment behavior to increase one and fix some issues

* set fullscreen if maxed out

* allow splitting stacks

* fix tests mostly by parameterizing stacked_resize

* add tests

* some cleanups

* style(fmt): rustfmt

* add to config

* disable ci cache

* is_stacked => stacked

* docs(config): remove duplication
  • Loading branch information
imsnif authored Jan 28, 2025
1 parent 7f0b8b6 commit 407120b
Show file tree
Hide file tree
Showing 72 changed files with 7,132 additions and 295 deletions.
5 changes: 5 additions & 0 deletions example/default.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,8 @@ load_plugins {
// Default: true (if the host terminal supports it)
//
// support_kitty_keyboard_protocol false

// Whether to stack panes when resizing beyond a certain size
// Default: true
//
// stacked_resize false
16 changes: 8 additions & 8 deletions src/tests/e2e/remote_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ impl RemoteRunner {
y: 0,
rows,
cols,
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down Expand Up @@ -493,7 +493,7 @@ impl RemoteRunner {
y: 0,
rows,
cols,
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down Expand Up @@ -531,7 +531,7 @@ impl RemoteRunner {
y: 0,
rows,
cols,
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down Expand Up @@ -572,7 +572,7 @@ impl RemoteRunner {
y: 0,
rows,
cols,
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down Expand Up @@ -620,7 +620,7 @@ impl RemoteRunner {
y: 0,
rows,
cols,
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down Expand Up @@ -658,7 +658,7 @@ impl RemoteRunner {
y: 0,
rows,
cols,
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down Expand Up @@ -696,7 +696,7 @@ impl RemoteRunner {
y: 0,
rows,
cols,
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down Expand Up @@ -735,7 +735,7 @@ impl RemoteRunner {
y: 0,
rows,
cols,
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down
1 change: 1 addition & 0 deletions zellij-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ impl SessionMetaData {
auto_layout: new_config.options.auto_layout.unwrap_or(true),
rounded_corners: new_config.ui.pane_frames.rounded_corners,
hide_session_name: new_config.ui.pane_frames.hide_session_name,
stacked_resize: new_config.options.stacked_resize.unwrap_or(true),
})
.unwrap();
self.senders
Expand Down
10 changes: 5 additions & 5 deletions zellij-server/src/panes/floating_panes/floating_pane_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ pub fn half_size_middle_geom(space: &Viewport, offset: usize) -> PaneGeom {
y: space.y + (space.rows as f64 / 4.0).round() as usize + offset,
cols: Dimension::fixed(space.cols / 2),
rows: Dimension::fixed(space.rows / 2),
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand All @@ -871,7 +871,7 @@ fn half_size_top_left_geom(space: &Viewport, offset: usize) -> PaneGeom {
y: space.y + 2 + offset,
cols: Dimension::fixed(space.cols / 3),
rows: Dimension::fixed(space.rows / 3),
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand All @@ -886,7 +886,7 @@ fn half_size_top_right_geom(space: &Viewport, offset: usize) -> PaneGeom {
y: space.y + 2 + offset,
cols: Dimension::fixed(space.cols / 3),
rows: Dimension::fixed(space.rows / 3),
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand All @@ -901,7 +901,7 @@ fn half_size_bottom_left_geom(space: &Viewport, offset: usize) -> PaneGeom {
y: ((space.y + space.rows) - (space.rows / 3) - 2).saturating_sub(offset),
cols: Dimension::fixed(space.cols / 3),
rows: Dimension::fixed(space.rows / 3),
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand All @@ -916,7 +916,7 @@ fn half_size_bottom_right_geom(space: &Viewport, offset: usize) -> PaneGeom {
y: ((space.y + space.rows) - (space.rows / 3) - 2).saturating_sub(offset),
cols: Dimension::fixed(space.cols / 3),
rows: Dimension::fixed(space.rows / 3),
is_stacked: false,
stacked: None,
is_pinned: false,
logical_position: None,
};
Expand Down
Loading

0 comments on commit 407120b

Please sign in to comment.