aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src
diff options
context:
space:
mode:
authorThomas Linford <tlinford@users.noreply.github.com>2022-02-12 12:51:10 +0100
committerGitHub <noreply@github.com>2022-02-12 12:51:10 +0100
commit10a22c479ffb4d76627eadbee2dc4b53ae4309c3 (patch)
tree130c339575870daa828e37afba265065cbaa49e7 /zellij-server/src
parentdocs(changelog): update the confusing tips (diff)
downloadsl0ppij-10a22c479ffb4d76627eadbee2dc4b53ae4309c3.tar.gz
sl0ppij-10a22c479ffb4d76627eadbee2dc4b53ae4309c3.tar.xz
sl0ppij-10a22c479ffb4d76627eadbee2dc4b53ae4309c3.zip
fix(compatibility): resolve fzf crash (#1056)
* grid: add fzf test case * revert alternate viewport creation to contain an empty row
Diffstat (limited to 'zellij-server/src')
-rw-r--r--zellij-server/src/panes/grid.rs5
-rw-r--r--zellij-server/src/panes/unit/grid_tests.rs12
-rw-r--r--zellij-server/src/panes/unit/snapshots/zellij_server__panes__grid__grid_tests__fzf_fullscreen.snap57
3 files changed, 73 insertions, 1 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs
index 8669cfe6..ab472aea 100644
--- a/zellij-server/src/panes/grid.rs
+++ b/zellij-server/src/panes/grid.rs
@@ -1875,7 +1875,10 @@ impl Perform for Grid {
&mut self.lines_above,
VecDeque::with_capacity(*SCROLL_BUFFER_SIZE.get().unwrap()),
);
- let current_viewport = std::mem::take(&mut self.viewport);
+ let current_viewport = std::mem::replace(
+ &mut self.viewport,
+ vec![Row::new(self.width).canonical()],
+ );
let current_cursor = std::mem::replace(&mut self.cursor, Cursor::new(0, 0));
self.alternate_lines_above_viewport_and_cursor =
Some((current_lines_above, current_viewport, current_cursor));
diff --git a/zellij-server/src/panes/unit/grid_tests.rs b/zellij-server/src/panes/unit/grid_tests.rs
index 7fbfd119..57e97725 100644
--- a/zellij-server/src/panes/unit/grid_tests.rs
+++ b/zellij-server/src/panes/unit/grid_tests.rs
@@ -1106,3 +1106,15 @@ pub fn alternate_screen_change_size() {
assert_snapshot!(format!("{:?}", grid));
assert_eq!(grid.scrollback_position_and_length(), (0, 0))
}
+
+#[test]
+pub fn fzf_fullscreen() {
+ let mut vte_parser = vte::Parser::new();
+ let mut grid = Grid::new(51, 112, Palette::default());
+ let fixture_name = "fzf_fullscreen";
+ let content = read_fixture(fixture_name);
+ for byte in content {
+ vte_parser.advance(&mut grid, byte);
+ }
+ assert_snapshot!(format!("{:?}", grid));
+}
diff --git a/zellij-server/src/panes/unit/snapshots/zellij_server__panes__grid__grid_tests__fzf_fullscreen.snap b/zellij-server/src/panes/unit/snapshots/zellij_server__panes__grid__grid_tests__fzf_fullscreen.snap
new file mode 100644
index 00000000..13aac7ab
--- /dev/null
+++ b/zellij-server/src/panes/unit/snapshots/zellij_server__panes__grid__grid_tests__fzf_fullscreen.snap
@@ -0,0 +1,57 @@
+---
+source: zellij-server/src/panes/./unit/grid_tests.rs
+expression: "format!(\"{:?}\", grid)"
+
+---
+00 (C): src/tests/fixtures/fish_and_bandwhich
+01 (C): src/tests/fixtures/exa_plus_omf_theme
+02 (C): src/tests/fixtures/emacs_longbuf_tutorial
+03 (C): src/tests/fixtures/clear_scroll_region
+04 (C): src/tests/fixtures/bash_cursor_linewrap
+05 (C): example/themes/tokyo-night.yaml
+06 (C): example/default.yaml
+07 (C): example/alt-centered-config.yaml
+08 (C): example/tmux-overview.yaml
+09 (C): example/layouts/run_htop_layout_with_plugins.yaml
+10 (C): example/layouts/multiple_tabs_layout_htop_command.yaml
+11 (C): example/layouts/multiple_tabs_layout.yaml
+12 (C): example/layouts/run_htop_layout.yaml
+13 (C): example/config.yaml
+14 (C): example/tmux.nonfunctional
+15 (C): example/screen.nonfunctional
+16 (C): example/screen-overview.yaml
+17 (C): example/README.md
+18 (C): docs/MANPAGE.md
+19 (C): docs/ARCHITECTURE.md
+20 (C): docs/TERMINOLOGY.md
+21 (C): default-plugins/tab-bar/Cargo.toml
+22 (C): default-plugins/tab-bar/src/tab.rs
+23 (C): default-plugins/tab-bar/src/main.rs
+24 (C): default-plugins/tab-bar/src/line.rs
+25 (C): default-plugins/tab-bar/LICENSE.md
+26 (C): default-plugins/strider/Cargo.toml
+27 (C): default-plugins/strider/src/state.rs
+28 (C): default-plugins/strider/src/main.rs
+29 (C): default-plugins/strider/LICENSE.md
+30 (C): default-plugins/status-bar/Cargo.toml
+31 (C): default-plugins/status-bar/src/second_line.rs
+32 (C): default-plugins/status-bar/src/first_line.rs
+33 (C): default-plugins/status-bar/src/main.rs
+34 (C): default-plugins/status-bar/src/tip/utils.rs
+35 (C): default-plugins/status-bar/src/tip/mod.rs
+36 (C): default-plugins/status-bar/src/tip/data.rs
+37 (C): default-plugins/status-bar/src/tip/consts.rs
+38 (C): default-plugins/status-bar/src/tip/cache.rs
+39 (C): default-plugins/status-bar/LICENSE.md
+40 (C): assets/multiplayer-sessions.gif
+41 (C): assets/zellij.desktop
+42 (C): assets/demo.gif
+43 (C): assets/plugins/status-bar.wasm
+44 (C): assets/plugins/tab-bar.wasm
+45 (C): assets/plugins/strider.wasm
+46 (C): assets/logo.png
+47 (C): LICENSE.md
+48 (C): > CODE_OF_CONDUCT.md
+49 (C): 12363/12363
+50 (C): >
+