diff options
author | Brooks Rady <b.j.rady@gmail.com> | 2021-08-28 17:46:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-28 17:46:24 +0100 |
commit | 76a5bc8a05c33fb3f46cff1ce95aa1af694b9927 (patch) | |
tree | aa0c9e4b317d9d01906d11817b3b57f0047d7be8 /zellij-client | |
parent | 1544de266501bb7dbb0b044a04283b4fd5f59c6e (diff) |
feat(ui): overhauled resize and layout systems
* refactor(panes): move to parametric pane sizes
* Fixed the simpler errors by casting to usize
* The least I can do is pass the formatting check...
* Move to stable toolchain
* Well, it compiles?
* And now it doesn't! ;)
* Baseline functionality with the new Dimension type
* Working POC for percent-based resizing
* REVERT THIS COMMIT – DELETES TESTS
* Perfected the discrete resize algorithm
* Fixed fixed-size panes
* Basic bidirectional resize
* feat(resize): finalised parametric resize algorithm
* Reduce the logging level a bit
* Fixed nested layouts using percents
* Bug squishing for implicit sizing
* Here is a funky (read: rubbish) rounding approach
* And now it's gone again!
* Improve discretisation algorithm to fix rounding errors
* Fix the last layout bug (maybe?)
* Mixed explicit and implied percents work now
* Let's pretend that didn't happen...
* Make things a bit less crashy
* Crash slightly more for now (to find bugs)
* Manaually splitting of panes works now
* Start moving to percent-based resizes
* Everything but fullscreen seems to be working
* Fix compilatation errors
* Culled a massive amount of border code
* Why not pause to please rustfmt?
* Turns out I was still missing a few tests...
* Bringing back even more tests!
* Fix tests and pane boarders
* Fix the resize system without gaps
* Fix content offset
* Fixed a bug with pane closing
* Add a hack to fix setting of the viewport
* Fix toggling between shared borders and frames
* fix(tests): make e2e properly use PaneGeom
* style(fmt): make rustfmt happy
* Revert unintentional rounding of borders
* Purge some old borderless stuff
* Fix busted tab-bar shrinking
* Update E2E tests
* Finish implementing fullscreen!
* Don't crash anymore?
* Fix (almost) all tests
* Fix a lack of tab-stops
* All tests passing
* I really can't be bothered to debug a CI issue
* Tie up loose ends
* Knock out some lingering FIXMEs
* Continue to clean things up
* Change some naming and address FIXMEs
* Cull more code + FIXMEs
* Refactor of the resize system + polish
* Only draw frames when absolutely necessary
* Fix the tab-bar crash
* Fix rendering of boarders on reattach
* Fix resizing at small pane sizes
* Deduplicate code in the layout system
* Update tab-bar WASM
* Fixed the pinching of panes during resize
* Unexpose needlessly public type
* Add back a lost test
* Re-add tab tests and get them to compile
* All tabs need layouts
* Start fixing tests + bug in main
* Stabilize the resize algorithm rounding
* All tests from main are now passing
* Cull more dead code
Diffstat (limited to 'zellij-client')
-rw-r--r-- | zellij-client/src/lib.rs | 4 | ||||
-rw-r--r-- | zellij-client/src/os_input_output.rs | 13 | ||||
-rw-r--r-- | zellij-client/src/unit/input_handler_tests.rs | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index e806ec3bf..7d67a01ac 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -116,7 +116,7 @@ pub fn start_client( let full_screen_ws = os_input.get_terminal_size_using_fd(0); let client_attributes = ClientAttributes { - position_and_size: full_screen_ws, + size: full_screen_ws, palette, }; @@ -137,7 +137,7 @@ pub fn start_client( client_attributes, Box::new(opts), Box::new(config_options.clone()), - layout, + layout.unwrap(), ) } }; diff --git a/zellij-client/src/os_input_output.rs b/zellij-client/src/os_input_output.rs index 7242bf7aa..b5018c295 100644 --- a/zellij-client/src/os_input_output.rs +++ b/zellij-client/src/os_input_output.rs @@ -1,4 +1,5 @@ use zellij_utils::input::actions::Action; +use zellij_utils::pane_size::Size; use zellij_utils::{interprocess, libc, nix, signal_hook, termion, zellij_tile}; use interprocess::local_socket::LocalSocketStream; @@ -15,7 +16,6 @@ use zellij_tile::data::Palette; use zellij_utils::{ errors::ErrorContext, ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg}, - pane_size::PositionAndSize, shared::default_palette, }; @@ -35,7 +35,7 @@ fn unset_raw_mode(pid: RawFd, orig_termios: termios::Termios) { }; } -pub(crate) fn get_terminal_size_using_fd(fd: RawFd) -> PositionAndSize { +pub(crate) fn get_terminal_size_using_fd(fd: RawFd) -> Size { // TODO: do this with the nix ioctl use libc::ioctl; use libc::TIOCGWINSZ; @@ -54,7 +54,10 @@ pub(crate) fn get_terminal_size_using_fd(fd: RawFd) -> PositionAndSize { unsafe { ioctl(fd, TIOCGWINSZ.into(), &mut winsize) }; - PositionAndSize::from(winsize) + Size { + rows: winsize.ws_row as usize, + cols: winsize.ws_col as usize, + } } #[derive(Clone)] @@ -69,7 +72,7 @@ pub struct ClientOsInputOutput { /// Zellij client requires. pub trait ClientOsApi: Send + Sync { /// Returns the size of the terminal associated to file descriptor `fd`. - fn get_terminal_size_using_fd(&self, fd: RawFd) -> PositionAndSize; + fn get_terminal_size_using_fd(&self, fd: RawFd) -> Size; /// Set the terminal associated to file descriptor `fd` to /// [raw mode](https://en.wikipedia.org/wiki/Terminal_mode). fn set_raw_mode(&mut self, fd: RawFd); @@ -98,7 +101,7 @@ pub trait ClientOsApi: Send + Sync { } impl ClientOsApi for ClientOsInputOutput { - fn get_terminal_size_using_fd(&self, fd: RawFd) -> PositionAndSize { + fn get_terminal_size_using_fd(&self, fd: RawFd) -> Size { get_terminal_size_using_fd(fd) } fn set_raw_mode(&mut self, fd: RawFd) { diff --git a/zellij-client/src/unit/input_handler_tests.rs b/zellij-client/src/unit/input_handler_tests.rs index 9b0bc71c1..a9b86a75d 100644 --- a/zellij-client/src/unit/input_handler_tests.rs +++ b/zellij-client/src/unit/input_handler_tests.rs @@ -2,7 +2,7 @@ use super::input_loop; use zellij_utils::input::actions::{Action, Direction}; use zellij_utils::input::config::Config; use zellij_utils::input::options::Options; -use zellij_utils::pane_size::PositionAndSize; +use zellij_utils::pane_size::Size; use zellij_utils::zellij_tile::data::Palette; use crate::{os_input_output::ClientOsApi, ClientInstruction, CommandIsExecuting}; @@ -93,7 +93,7 @@ impl FakeClientOsApi { } impl ClientOsApi for FakeClientOsApi { - fn get_terminal_size_using_fd(&self, _fd: RawFd) -> PositionAndSize { + fn get_terminal_size_using_fd(&self, _fd: RawFd) -> Size { unimplemented!() } fn set_raw_mode(&mut self, _fd: RawFd) { |