summaryrefslogtreecommitdiffstats
path: root/zellij-server/src/tab/unit/tab_integration_tests.rs
diff options
context:
space:
mode:
authorhar7an <99636919+har7an@users.noreply.github.com>2022-10-06 06:46:18 +0000
committerGitHub <noreply@github.com>2022-10-06 06:46:18 +0000
commit6715f4629c664885e0800da76cd73ca470705b27 (patch)
tree08eb83fd3212df743f83ec8a9ed399956f926d51 /zellij-server/src/tab/unit/tab_integration_tests.rs
parent46edc590ecda91cfb47456e46be4c618b35c8cc3 (diff)
Server: Remove `panic`s in `tab` module (#1748)
* utils/errors: Add `ToAnyhow` trait for converting `Result` types that don't satisfy `anyhow`s trait constraints (`Display + Send + Sync + 'static`) conveniently. An example of such a Result is the `SendError` returned from `send_to_plugins`, which sends `PluginInstruction`s as message type. One of the enum variants can contain a `mpsc::Sender`, which is `!Sync` and hence makes the whole `SendError` be `!Sync` in this case. Add an implementation for this case that takes the message and converts it into an error containing the message formatted as string, with the additional `ErrorContext` as anyhow context. * server/tab: Remove calls to `unwrap()` and apply error reporting via `anyhow` instead. Make all relevant functions return `Result`s where previously a panic could occur and attach error context. * server/screen: Modify `update_tab!` to accept an optional 4th parameter, a literal "?". If present, this will append a `?` to the given closure verbatim to handle/propagate errors from within the generated macro code. * server/screen: Handle new `Result`s from `Tab` and apply appropriate error context and propagate errors further up. * server/tab/unit: `unwrap` on new `Result`s * server/unit: Unwrap `Results` in screen tests * server/tab: Better message for ad-hoc errors created with `anyhow!`. Since these errors don't have an underlying cause, we describe the cause in the macro instead and then attach the error context as usual before `?`ing the error back up. * utils/cargo: Activate `anyhow`s "backtrace" feature to capture error backtraces at the error origins (i.e. where we first receive an error and convert it to a `anyhow::Error`). Since we propagate error back up the call stack now, the place where we `unwrap` on errors doesn't match the place where the error originated. Hence, the callstack, too, is quite misleading since it contains barely any references of the functions that triggered the error. As a consequence, we have 2 backtraces now when zellij crashes: One from `anyhow` (that is implicitly attached to anyhows error reports), and one from the custom panic handler (which is displayed through `miette`). * utils/errors: Separate stack traces in the output of miette. Since we record backtraces with `anyhow` now, we end up having two backtraces in the output: One from the `anyhow` error and one from the actual call to `panic`. Adds a comment explaining the situation and another "section" to the error output of miette: We print the backtrace from anyhow as "Stack backtrace", and the output from the panic handler as "Panic backtrace". We keep both for the (hopefully unlikely) case that the anyhow backtrace isn't existent, so we still have at least something to work with. * server/screen: Remove calls to `fatal` and leave the `panic`ing to the calling function instead. * server/screen: Remove needless macro which extended `active_tab!` by passing the client IDs to the closure. However, this isn't necessary because closures capture their environment already, and the client_id needn't be mutable. * server/screen: Handle unused result * server/screen: Reintroduce arcane macro that defaults to some default client_id if it isn't valid (e.g. when the ScreenInstruction is sent via CLI). * server/tab/unit: Unwrap new results
Diffstat (limited to 'zellij-server/src/tab/unit/tab_integration_tests.rs')
-rw-r--r--zellij-server/src/tab/unit/tab_integration_tests.rs876
1 files changed, 522 insertions, 354 deletions
diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs
index 3b26bc26e..632b65b12 100644
--- a/zellij-server/src/tab/unit/tab_integration_tests.rs
+++ b/zellij-server/src/tab/unit/tab_integration_tests.rs
@@ -212,7 +212,8 @@ fn create_new_tab(size: Size, default_mode: ModeInfo) -> Tab {
terminal_emulator_colors,
terminal_emulator_color_codes,
);
- tab.apply_layout(PaneLayout::default(), vec![1], index, client_id);
+ tab.apply_layout(PaneLayout::default(), vec![1], index, client_id)
+ .unwrap();
tab
}
@@ -267,7 +268,8 @@ fn create_new_tab_with_layout(size: Size, default_mode: ModeInfo, layout: &str)
.enumerate()
.map(|(i, _)| i as i32)
.collect();
- tab.apply_layout(tab_layout, pane_ids, index, client_id);
+ tab.apply_layout(tab_layout, pane_ids, index, client_id)
+ .unwrap();
tab
}
@@ -325,7 +327,8 @@ fn create_new_tab_with_mock_pty_writer(
vec![1],
index,
client_id,
- );
+ )
+ .unwrap();
tab
}
@@ -379,7 +382,8 @@ fn create_new_tab_with_sixel_support(
terminal_emulator_colors,
terminal_emulator_color_codes,
);
- tab.apply_layout(PaneLayout::default(), vec![1], index, client_id);
+ tab.apply_layout(PaneLayout::default(), vec![1], index, client_id)
+ .unwrap();
tab
}
@@ -487,8 +491,9 @@ fn dump_screen() {
file_dumps: map.clone(),
});
let new_pane_id = PaneId::Terminal(2);
- tab.new_pane(new_pane_id, Some(client_id));
- tab.handle_pty_bytes(2, Vec::from("scratch".as_bytes()));
+ tab.new_pane(new_pane_id, Some(client_id)).unwrap();
+ tab.handle_pty_bytes(2, Vec::from("scratch".as_bytes()))
+ .unwrap();
let file = "/tmp/log.sh";
tab.dump_active_terminal_screen(Some(file.to_string()), client_id);
assert_eq!(
@@ -508,13 +513,14 @@ fn new_floating_pane() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.render(&mut output, None);
+ )
+ .unwrap();
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -534,17 +540,18 @@ fn floating_panes_persist_across_toggles() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id, Some(client_id));
- tab.toggle_floating_panes(client_id, None);
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id, Some(client_id)).unwrap();
+ tab.toggle_floating_panes(client_id, None).unwrap();
// here we send bytes to the pane when it's not visible to make sure they're still handled and
// we see them once we toggle the panes back
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.toggle_floating_panes(client_id, None);
- tab.render(&mut output, None);
+ )
+ .unwrap();
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -564,14 +571,15 @@ fn toggle_floating_panes_off() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.toggle_floating_panes(client_id, None);
- tab.render(&mut output, None);
+ )
+ .unwrap();
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -591,15 +599,16 @@ fn toggle_floating_panes_on() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.toggle_floating_panes(client_id, None);
- tab.toggle_floating_panes(client_id, None);
- tab.render(&mut output, None);
+ )
+ .unwrap();
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -623,21 +632,26 @@ fn five_new_floating_panes() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
- tab.new_pane(new_pane_id_2, Some(client_id));
- tab.new_pane(new_pane_id_3, Some(client_id));
- tab.new_pane(new_pane_id_4, Some(client_id));
- tab.new_pane(new_pane_id_5, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_2, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_3, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_4, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_5, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()));
- tab.render(&mut output, None);
+ )
+ .unwrap();
+ tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -657,14 +671,15 @@ fn increase_floating_pane_size() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id_1 = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
+ )
+ .unwrap();
tab.resize_increase(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -684,14 +699,15 @@ fn decrease_floating_pane_size() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id_1 = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
+ )
+ .unwrap();
tab.resize_decrease(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -711,14 +727,15 @@ fn resize_floating_pane_left() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id_1 = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
+ )
+ .unwrap();
tab.resize_left(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -738,14 +755,15 @@ fn resize_floating_pane_right() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id_1 = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
+ )
+ .unwrap();
tab.resize_right(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -765,14 +783,15 @@ fn resize_floating_pane_up() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id_1 = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
+ )
+ .unwrap();
tab.resize_up(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -792,14 +811,15 @@ fn resize_floating_pane_down() {
let mut tab = create_new_tab(size, ModeInfo::default());
let new_pane_id_1 = PaneId::Terminal(2);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
+ )
+ .unwrap();
tab.resize_down(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let snapshot = take_snapshot(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -823,22 +843,27 @@ fn move_floating_pane_focus_left() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
- tab.new_pane(new_pane_id_2, Some(client_id));
- tab.new_pane(new_pane_id_3, Some(client_id));
- tab.new_pane(new_pane_id_4, Some(client_id));
- tab.new_pane(new_pane_id_5, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_2, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_3, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_4, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_5, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()));
+ )
+ .unwrap();
+ tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
tab.move_focus_left(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -868,23 +893,28 @@ fn move_floating_pane_focus_right() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
- tab.new_pane(new_pane_id_2, Some(client_id));
- tab.new_pane(new_pane_id_3, Some(client_id));
- tab.new_pane(new_pane_id_4, Some(client_id));
- tab.new_pane(new_pane_id_5, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_2, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_3, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_4, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_5, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()));
+ )
+ .unwrap();
+ tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
tab.move_focus_left(client_id);
tab.move_focus_right(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -914,22 +944,27 @@ fn move_floating_pane_focus_up() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
- tab.new_pane(new_pane_id_2, Some(client_id));
- tab.new_pane(new_pane_id_3, Some(client_id));
- tab.new_pane(new_pane_id_4, Some(client_id));
- tab.new_pane(new_pane_id_5, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_2, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_3, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_4, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_5, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()));
+ )
+ .unwrap();
+ tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
tab.move_focus_up(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -959,23 +994,28 @@ fn move_floating_pane_focus_down() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
- tab.new_pane(new_pane_id_2, Some(client_id));
- tab.new_pane(new_pane_id_3, Some(client_id));
- tab.new_pane(new_pane_id_4, Some(client_id));
- tab.new_pane(new_pane_id_5, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_2, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_3, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_4, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_5, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()));
+ )
+ .unwrap();
+ tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
tab.move_focus_up(client_id);
tab.move_focus_down(client_id);
- tab.render(&mut output, None);
+ tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -1005,23 +1045,30 @@ fn move_floating_pane_focus_with_mouse() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
- tab.new_pane(new_pane_id_2, Some(client_id));
- tab.new_pane(new_pane_id_3, Some(client_id));
- tab.new_pane(new_pane_id_4, Some(client_id));
- tab.new_pane(new_pane_id_5, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_2, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_3, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_4, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_5, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_left_click(&Position::new(9, 71), client_id);
- tab.handle_left_mouse_release(&Position::new(9, 71), client_id);
- tab.render(&mut output, None);
+ )
+ .unwrap();
+ tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_left_click(&Position::new(9, 71), client_id)
+ .unwrap();
+ tab.handle_left_mouse_release(&Position::new(9, 71), client_id)
+ .unwrap();
+ tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -1051,23 +1098,30 @@ fn move_pane_focus_with_mouse_to_non_floating_pane() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
- tab.new_pane(new_pane_id_2, Some(client_id));
- tab.new_pane(new_pane_id_3, Some(client_id));
- tab.new_pane(new_pane_id_4, Some(client_id));
- tab.new_pane(new_pane_id_5, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_2, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_3, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_4, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_5, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_left_click(&Position::new(4, 71), client_id);
- tab.handle_left_mouse_release(&Position::new(4, 71), client_id);
- tab.render(&mut output, None);
+ )
+ .unwrap();
+ tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_left_click(&Position::new(4, 71), client_id)
+ .unwrap();
+ tab.handle_left_mouse_release(&Position::new(4, 71), client_id)
+ .unwrap();
+ tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -1097,23 +1151,30 @@ fn drag_pane_with_mouse() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_panes(client_id, None);
- tab.new_pane(new_pane_id_1, Some(client_id));
- tab.new_pane(new_pane_id_2, Some(client_id));
- tab.new_pane(new_pane_id_3, Some(client_id));
- tab.new_pane(new_pane_id_4, Some(client_id));
- tab.new_pane(new_pane_id_5, Some(client_id));
+ tab.toggle_floating_panes(client_id, None).unwrap();
+ tab.new_pane(new_pane_id_1, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_2, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_3, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_4, Some(client_id)).unwrap();
+ tab.new_pane(new_pane_id_5, Some(client_id)).unwrap();
tab.handle_pty_bytes(
2,
Vec::from("\n\n\n I am scratch terminal".as_bytes()),
- );
- tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()));
- tab.handle_left_click(&Position::new(5, 71), client_id);
- tab.handle_left_mouse_release(&Position::new(7, 75), client_id);
- tab.render(&mut output, None);
+ )
+ .unwrap();
+ tab.handle_pty_bytes(3, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(4, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(5, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_pty_bytes(6, Vec::from("\u{1b}#8".as_bytes()))
+ .unwrap();
+ tab.handle_left_click(&Position::new(5, 71), client_id)
+ .unwrap();
+ tab.handle_left_mouse_release(&Position::new(7, 75), client_id)
+ .unwrap();
+ tab.render(&mut output, None).unwrap();
let (snapshot, cursor_coordinates) = take_snapshot_and_cursor_position(
output.serialize().get(&client_id).unwrap(),
size.rows,
@@ -1143,31 +1204,38 @@ fn mark_text_inside_floating_pane() {
let new_pane_id_4 = PaneId::Terminal(5);
let new_pane_id_5 = PaneId::Terminal(6);
let mut output = Output::default();
- tab.toggle_floating_