Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix fzf crash #1056

Merged
merged 2 commits into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/tests/fixtures/fzf_fullscreen
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Welcome to fish, the friendly interactive shell
Type `help` for instructions on how to use fish
[?2004h]0;fish /home/thomas/Projects/zellij(B
zellij on  fix/fzf-crash [$!?] is 📦 v0.25.0 via 🦀 v1.58.1 
❯ ff(Bzf(Bzf(Bf(Bfzf(B
(B[?2004l]0;fzf /home/thomas/Projects/zellij(B[?1049h[?1000h                                                    >  ⠹0/0 ⠹0/2419 ⠹2419/2419  src/tests/fixtures/fish_and_bandwhich  src/tests/fixtures/exa_plus_omf_theme  src/tests/fixtures/emacs_longbuf_tutorial  src/tests/fixtures/clear_scroll_region  src/tests/fixtures/bash_cursor_linewrap  example/themes/tokyo-night.yaml  example/default.yaml  example/alt-centered-config.yaml  example/tmux-overview.yaml  example/layouts/run_htop_layout_with_plugins.yaml  example/layouts/multiple_tabs_layout_htop_command.yaml  example/layouts/multiple_tabs_layout.yaml  example/layouts/run_htop_layout.yaml  example/config.yaml  example/tmux.nonfunctional  example/screen.nonfunctional  example/screen-overview.yaml  example/README.md  docs/MANPAGE.md  docs/ARCHITECTURE.md  docs/TERMINOLOGY.md  default-plugins/tab-bar/Cargo.toml  default-plugins/tab-bar/src/tab.rs  default-plugins/tab-bar/src/main.rs  default-plugins/tab-bar/src/line.rs  default-plugins/tab-bar/LICENSE.md  default-plugins/strider/Cargo.toml  default-plugins/strider/src/state.rs  default-plugins/strider/src/main.rs  default-plugins/strider/LICENSE.md  default-plugins/status-bar/Cargo.toml  default-plugins/status-bar/src/second_line.rs  default-plugins/status-bar/src/first_line.rs  default-plugins/status-bar/src/main.rs  default-plugins/status-bar/src/tip/utils.rs  default-plugins/status-bar/src/tip/mod.rs  default-plugins/status-bar/src/tip/data.rs  default-plugins/status-bar/src/tip/consts.rs  default-plugins/status-bar/src/tip/cache.rs  default-plugins/status-bar/LICENSE.md  assets/multiplayer-sessions.gif  assets/zellij.desktop  assets/demo.gif  assets/plugins/status-bar.wasm  assets/plugins/tab-bar.wasm  assets/plugins/strider.wasm  assets/logo.png  LICENSE.md> CODE_OF_CONDUCT.md ⠹2419/12288 12363/12363 12363/12363
Expand Down
5 changes: 4 additions & 1 deletion zellij-server/src/panes/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
12 changes: 12 additions & 0 deletions zellij-server/src/panes/unit/grid_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Original file line number Diff line number Diff line change
@@ -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): >