From 0601079023165a23e6ee8a3f25a7eea7dc81e639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Fri, 23 Aug 2024 18:53:43 +0800 Subject: [PATCH] fix: wait till mimetype is resolved to avoid flickering (#1542) --- Cargo.lock | 4 ++-- yazi-boot/Cargo.toml | 2 +- yazi-cli/Cargo.toml | 2 +- yazi-core/src/manager/commands/peek.rs | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bdeac22f9..e43caf50a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -406,9 +406,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.19" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eddf1c00919f37952199f7dbc834789cd33356ed10278ee40c8572b8fb88cf2" +checksum = "531d7959c5bbb6e266cecdd0f20213639c3a5c3e4d615f97db87661745f781ff" dependencies = [ "clap", ] diff --git a/yazi-boot/Cargo.toml b/yazi-boot/Cargo.toml index 85e4f402f..8b8e03b42 100644 --- a/yazi-boot/Cargo.toml +++ b/yazi-boot/Cargo.toml @@ -20,7 +20,7 @@ serde = { workspace = true } [build-dependencies] clap = { workspace = true } -clap_complete = "4.5.19" +clap_complete = "4.5.23" clap_complete_fig = "4.5.2" clap_complete_nushell = "4.5.3" vergen-gitcl = { version = "1.0.0", features = [ "build" ] } diff --git a/yazi-cli/Cargo.toml b/yazi-cli/Cargo.toml index dbaab9f8a..114f2784d 100644 --- a/yazi-cli/Cargo.toml +++ b/yazi-cli/Cargo.toml @@ -28,7 +28,7 @@ yazi-shared = { path = "../yazi-shared", version = "0.3.1" } # External build dependencies anyhow = { workspace = true } clap = { workspace = true } -clap_complete = "4.5.19" +clap_complete = "4.5.23" clap_complete_fig = "4.5.2" clap_complete_nushell = "4.5.3" serde_json = { workspace = true } diff --git a/yazi-core/src/manager/commands/peek.rs b/yazi-core/src/manager/commands/peek.rs index 0d8b71e21..0efdd7fb7 100644 --- a/yazi-core/src/manager/commands/peek.rs +++ b/yazi-core/src/manager/commands/peek.rs @@ -56,6 +56,9 @@ impl Manager { } let mime = self.mimetype.get(&hovered.url).cloned().unwrap_or_default(); - self.active_mut().preview.go(hovered, &mime, opt.force); + if !mime.is_empty() { + // Wait till mimetype is resolved to avoid flickering + self.active_mut().preview.go(hovered, &mime, opt.force); + } } }