diff options
author | Aram Drevekenin <aram@poor.dev> | 2021-08-12 14:50:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-12 14:50:00 +0200 |
commit | a37d3e5889476bbac209d20f89886daa3e9d3992 (patch) | |
tree | c02fbf779dda57b615a852fd6a43818b20722b19 /default-plugins | |
parent | 426cee728a3b8c84edbc2d02cbc22f4840fc6a28 (diff) |
feat(ui): pane frames (new pane UI) (#643)
* work
* resize working
* move focus working
* close pane working
* selection and fullscreen working
* pane title line
* titles and conditional scroll title
* whole tab resize working
* plugin frames working
* plugin splitting working
* truncate pane frame titles
* cleanup
* panes always draw their own borders - also fix gap
* toggle pane frames
* move toggle to screen and fix some bugs
* fix plugin frame toggle
* fix terminal window resize
* fix scrolling and fullscreen bugs
* unit tests passing
* e2e tests passing and new test for new frames added
* refactor: TerminalPane and PluginPane
* refactor: Tab
* refactor: moar Tab
* refactor: Boundaries
* only render and calculate boundaries when there are no pane frames
* refactor: Layout
* fix(grid): properly resize when coming back from alternative viewport
* style: remove commented code
* style: fmt
* style: fmt
* style: fmt + clippy
* docs(changelog): update change
Diffstat (limited to 'default-plugins')
-rw-r--r-- | default-plugins/status-bar/src/main.rs | 6 | ||||
-rw-r--r-- | default-plugins/strider/src/state.rs | 6 | ||||
-rw-r--r-- | default-plugins/tab-bar/src/line.rs | 6 |
3 files changed, 11 insertions, 7 deletions
diff --git a/default-plugins/status-bar/src/main.rs b/default-plugins/status-bar/src/main.rs index 83eb50c9a..dba373f6b 100644 --- a/default-plugins/status-bar/src/main.rs +++ b/default-plugins/status-bar/src/main.rs @@ -154,7 +154,11 @@ impl ZellijPlugin for State { let colored_elements = color_elements(self.mode_info.palette); let superkey = superkey(colored_elements, separator); - let ctrl_keys = ctrl_keys(&self.mode_info, cols - superkey.len, separator); + let ctrl_keys = ctrl_keys( + &self.mode_info, + cols.saturating_sub(superkey.len), + separator, + ); let first_line = format!("{}{}", superkey, ctrl_keys); let second_line = keybinds(&self.mode_info, cols); diff --git a/default-plugins/strider/src/state.rs b/default-plugins/strider/src/state.rs index 0d96ae0b9..0ae84ab29 100644 --- a/default-plugins/strider/src/state.rs +++ b/default-plugins/strider/src/state.rs @@ -47,10 +47,10 @@ impl FsEntry { FsEntry::Dir(_, s) => s.to_string(), FsEntry::File(_, s) => pb::convert(*s as f64), }; - let space = width - info.len(); + let space = width.saturating_sub(info.len()); let name = self.name(); - if space - 1 < name.len() { - [&name[..space - 2], &info].join("~ ") + if space.saturating_sub(1) < name.len() { + [&name[..space.saturating_sub(2)], &info].join("~ ") } else { let padding = " ".repeat(space - name.len()); [name, padding, info].concat() diff --git a/default-plugins/tab-bar/src/line.rs b/default-plugins/tab-bar/src/line.rs index 3ebeaac31..fc18abfd1 100644 --- a/default-plugins/tab-bar/src/line.rs +++ b/default-plugins/tab-bar/src/line.rs @@ -191,7 +191,7 @@ pub fn tab_line( &mut tabs_before_active, &mut tabs_after_active, &mut tabs_to_render, - cols - prefix.len, + cols.saturating_sub(prefix.len), ); let mut tab_line: Vec<LinePart> = vec![]; @@ -200,7 +200,7 @@ pub fn tab_line( &mut tabs_before_active, &mut tabs_to_render, &mut tab_line, - cols - prefix.len, + cols.saturating_sub(prefix.len), palette, tab_separator(capabilities), ); @@ -210,7 +210,7 @@ pub fn tab_line( add_next_tabs_msg( &mut tabs_after_active, &mut tab_line, - cols - prefix.len, + cols.saturating_sub(prefix.len), palette, tab_separator(capabilities), ); |