diff options
author | Henil Dedania <dedaniahenil@gmail.com> | 2021-11-05 13:59:45 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 09:29:45 +0100 |
commit | 4ac9344085a6a59e78608954cf89955f4e9ddb61 (patch) | |
tree | 2fe9fb7697ec92437af19ce77627c374f5db35ec /zellij-server/src/screen.rs | |
parent | 3e052519f90b39e86f581fd0b8cabc0049736211 (diff) |
feature(resize): Non directional resize (#520)
* feature(resize): Non directional resize
* Implement special cases
* fix resizing for panes that have `+` cross section
* fix resizing for panes that have `T` cross section
* fix panics
* Add Nondirection resize keys to plugin
* fix formatting
* fix: clippy warnings
* fix the last edge case
* implemented some of the suggested changes
* Remove helper function and elevate comment to top of function
* Use `=` to keep it consistent with Normal mode mapping as its easier to use
* Remove extra reference borrowing
* fix an edge case
* add test for nondirectional resize increase/decrease
* fix(controls): add + to resize
* refactor(resize): simplify methods
* fix(resize): properly resize opposite corner pane
Co-authored-by: Aram Drevekenin <aram@poor.dev>
Diffstat (limited to 'zellij-server/src/screen.rs')
-rw-r--r-- | zellij-server/src/screen.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 4852b305b..2a8c54c6a 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -35,6 +35,8 @@ pub(crate) enum ScreenInstruction { ResizeRight(ClientId), ResizeDown(ClientId), ResizeUp(ClientId), + ResizeIncrease(ClientId), + ResizeDecrease(ClientId), SwitchFocus(ClientId), FocusNextPane(ClientId), FocusPreviousPane(ClientId), @@ -95,6 +97,8 @@ impl From<&ScreenInstruction> for ScreenContext { ScreenInstruction::ResizeRight(..) => ScreenContext::ResizeRight, ScreenInstruction::ResizeDown(..) => ScreenContext::ResizeDown, ScreenInstruction::ResizeUp(..) => ScreenContext::ResizeUp, + ScreenInstruction::ResizeIncrease(..) => ScreenContext::ResizeIncrease, + ScreenInstruction::ResizeDecrease(..) => ScreenContext::ResizeDecrease, ScreenInstruction::SwitchFocus(..) => ScreenContext::SwitchFocus, ScreenInstruction::FocusNextPane(..) => ScreenContext::FocusNextPane, ScreenInstruction::FocusPreviousPane(..) => ScreenContext::FocusPreviousPane, @@ -659,6 +663,22 @@ pub(crate) fn screen_thread_main( screen.render(); } + ScreenInstruction::ResizeIncrease(client_id) => { + screen + .get_active_tab_mut(client_id) + .unwrap() + .resize_increase(); + + screen.render(); + } + ScreenInstruction::ResizeDecrease(client_id) => { + screen + .get_active_tab_mut(client_id) + .unwrap() + .resize_decrease(); + + screen.render(); + } ScreenInstruction::SwitchFocus(client_id) => { screen.get_active_tab_mut(client_id).unwrap().move_focus(); |