From 3edc7cebf7048e5fa8f5d0b09be16be39e0e89d6 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Fri, 21 Jun 2024 13:33:39 +0200 Subject: [PATCH] fix(rendering): do not render cursor if there's nothign to render (#3439) --- zellij-server/src/tab/mod.rs | 3 +- ...k_floating_plugin_pane_to_a_new_tab-2.snap | 28 +++++++++---------- ...k_floating_plugin_pane_to_a_new_tab-3.snap | 24 ++++++++-------- ...k_floating_plugin_pane_to_a_new_tab-5.snap | 26 ++--------------- ..._can_break_plugin_pane_to_a_new_tab-4.snap | 6 ++-- ..._can_break_plugin_pane_to_a_new_tab-5.snap | 26 ++--------------- 6 files changed, 36 insertions(+), 77 deletions(-) diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index a548cc9e..3be998cb 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -1817,7 +1817,6 @@ impl Tab { for key in parse_keys(&adjusted_input) { plugin_updates.push((Some(pid), client_id, Event::Key(key))); } - log::info!("plugin_updates: {:?}", plugin_updates); self.senders .send_to_plugin(PluginInstruction::Update(plugin_updates)) .with_context(err_context)?; @@ -2001,8 +2000,8 @@ impl Tab { .with_context(err_context)?; } - self.render_cursor(output); if output.has_rendered_assets() { + self.render_cursor(output); self.hide_cursor_and_clear_display_as_needed(output); } diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-2.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-2.snap index 9ca5b2aa..e12b6aaa 100644 --- a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-2.snap +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-2.snap @@ -1,25 +1,25 @@ --- source: zellij-server/src/./unit/screen_tests.rs -assertion_line: 3171 +assertion_line: 3501 expression: "format!(\"{}\", snapshot)" --- -00 (C): ┌ tiled_pane ──────────────────────────────────────────────────────────────────┐ +00 (C): ┌ Pane #1 ─────────────────────────────────────────────────────────────────────┐ 01 (C): │ │ 02 (C): │ │ 03 (C): │ │ 04 (C): │ │ -05 (C): │ ┌ file:/path/to/fake/plugin ───────────┐ │ -06 (C): │ │Loading file:/path/to/fake/plugin │ │ -07 (C): │ │ │ │ -08 (C): │ │ │ │ -09 (C): │ │ │ │ -10 (C): │ │ │ │ -11 (C): │ │ │ │ -12 (C): │ │ │ │ -13 (C): │ │ │ │ -14 (C): │ └──────────────────────────────────────┘ │ -15 (C): │ │ -16 (C): │ │ +05 (C): │ │ +06 (C): │ │ +07 (C): │ ┌ file:/path/to/fake/plugin ───────────┐ │ +08 (C): │ │Loading file:/path/to/fake/plugin │ │ +09 (C): │ │ │ │ +10 (C): │ │ │ │ +11 (C): │ │ │ │ +12 (C): │ │ │ │ +13 (C): │ │ │ │ +14 (C): │ │ │ │ +15 (C): │ │ │ │ +16 (C): │ └──────────────────────────────────────┘ │ 17 (C): │ │ 18 (C): │ │ 19 (C): └──────────────────────────────────────────────────────────────────────────────┘ diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-3.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-3.snap index 1305aa26..652b5726 100644 --- a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-3.snap +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-3.snap @@ -1,25 +1,25 @@ --- source: zellij-server/src/./unit/screen_tests.rs -assertion_line: 3171 +assertion_line: 3501 expression: "format!(\"{}\", snapshot)" --- -00 (C): ┌ Pane #1 ─────────────────────────────────────────────────────────────────────┐ +00 (C): ┌ tiled_pane ──────────────────────────────────────────────────────────────────┐ 01 (C): │ │ 02 (C): │ │ 03 (C): │ │ 04 (C): │ │ 05 (C): │ │ 06 (C): │ │ -07 (C): │ ┌ file:/path/to/fake/plugin ───────────┐ │ -08 (C): │ │Loading file:/path/to/fake/plugin │ │ -09 (C): │ │ │ │ -10 (C): │ │ │ │ -11 (C): │ │ │ │ -12 (C): │ │ │ │ -13 (C): │ │ │ │ -14 (C): │ │ │ │ -15 (C): │ │ │ │ -16 (C): │ └──────────────────────────────────────┘ │ +07 (C): │ │ +08 (C): │ │ +09 (C): │ │ +10 (C): │ │ +11 (C): │ │ +12 (C): │ │ +13 (C): │ │ +14 (C): │ │ +15 (C): │ │ +16 (C): │ │ 17 (C): │ │ 18 (C): │ │ 19 (C): └──────────────────────────────────────────────────────────────────────────────┘ diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-5.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-5.snap index 7af6aae6..78be0977 100644 --- a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-5.snap +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_floating_plugin_pane_to_a_new_tab-5.snap @@ -1,26 +1,6 @@ --- source: zellij-server/src/./unit/screen_tests.rs -assertion_line: 2986 -expression: "format!(\"{}\", snapshot)" +assertion_line: 3503 +expression: "format!(\"{}\", snapshot_count)" --- -00 (C): ┌ tiled_pane ──────────────────────────────────────────────────────────────────┐ -01 (C): │ │ -02 (C): │ │ -03 (C): │ │ -04 (C): │ │ -05 (C): │ │ -06 (C): │ │ -07 (C): │ │ -08 (C): │ │ -09 (C): │ │ -10 (C): │ │ -11 (C): │ │ -12 (C): │ │ -13 (C): │ │ -14 (C): │ │ -15 (C): │ │ -16 (C): │ │ -17 (C): │ │ -18 (C): │ │ -19 (C): └──────────────────────────────────────────────────────────────────────────────┘ - +4 diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_plugin_pane_to_a_new_tab-4.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_plugin_pane_to_a_new_tab-4.snap index b938c7bc..2681e18e 100644 --- a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_plugin_pane_to_a_new_tab-4.snap +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_plugin_pane_to_a_new_tab-4.snap @@ -1,10 +1,10 @@ --- source: zellij-server/src/./unit/screen_tests.rs -assertion_line: 3097 +assertion_line: 3428 expression: "format!(\"{}\", snapshot)" --- -00 (C): ┌ plugin_pane_to_break_free ───────────────────────────────────────────────────┐ -01 (C): │Loading file:/path/to/fake/plugin │ +00 (C): ┌ pane_to_stay ────────────────────────────────────────────────────────────────┐ +01 (C): │ │ 02 (C): │ │ 03 (C): │ │ 04 (C): │ │ diff --git a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_plugin_pane_to_a_new_tab-5.snap b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_plugin_pane_to_a_new_tab-5.snap index bbcf4b3a..5f701fea 100644 --- a/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_plugin_pane_to_a_new_tab-5.snap +++ b/zellij-server/src/unit/snapshots/zellij_server__screen__screen_tests__screen_can_break_plugin_pane_to_a_new_tab-5.snap @@ -1,26 +1,6 @@ --- source: zellij-server/src/./unit/screen_tests.rs -assertion_line: 2914 -expression: "format!(\"{}\", snapshot)" +assertion_line: 3430 +expression: "format!(\"{}\", snapshot_count)" --- -00 (C): ┌ pane_to_stay ────────────────────────────────────────────────────────────────┐ -01 (C): │ │ -02 (C): │ │ -03 (C): │ │ -04 (C): │ │ -05 (C): │ │ -06 (C): │ │ -07 (C): │ │ -08 (C): │ │ -09 (C): │ │ -10 (C): │ │ -11 (C): │ │ -12 (C): │ │ -13 (C): │ │ -14 (C): │ │ -15 (C): │ │ -16 (C): │ │ -17 (C): │ │ -18 (C): │ │ -19 (C): └──────────────────────────────────────────────────────────────────────────────┘ - +4